kde5: how to restart plasma desktop
There are situations when you would want to restart your KDE plasma environment without having to restart the entire system. This maybe because you have compiled a new version of plasma, or your current plasma shell is hanging and is not responding.
Whatever the reason might be, you can easily restart your plasma environment if you have access to a console on your system. You will first need to kill the existing plasma shell, and then start another one.
bash$ kquitapp5 plasmashell && kstart5 plasmashell
Ideally, you will have a command prompt to work with where you will execute this command. If you have a completely frozen session, then it is quite possible that you don't have access to a terminal such as konsole or xterm. You may be able to get access to one of the linux console, by using Ctl+Alt+F1, or Ctl+Alt+F2 or Ctl+Alt+F3. You can get back to your desktop using Ctl+Alt+F7.
The above will only work with kde5 and however not with kde4. It is quite unlikely that you still have kde4 running. But just in case you do, use the following command to restart the plasma desktop.
bash$ killall plasma-desktop && kstart plasma-desktop
It is not very likely that you will need to restart the plasma desktop often. However, you can create a shell alias, that will save you the trouble of having to type it out. To do so, edit your shell configuration file such as .bashrc and add the following:
alias restartplasma='kquitapp5 plasmashell && kstart5 plasmashell'
Now, you should be able to restart the plasma desktop using the restartplasma command alias instead of having to remember and type out the entire command. It goes without saying that you can use any character sequence as the alias. Making it shorter means less typing.