How to Restart KDE Plasma Without Rebooting the Computer

Documentation

Restart KDE Plasma Desktop
Restart KDE Plasma Desktop.

Introduction

This guide will show you how to restart the KDE Plasma desktop environment without having to reboot the entire computer.

Generally this isn't something you will have to do regularly but if you run a Linux distribution with the KDE desktop and you leave your computer on for an extended period of time then you might find the desktop becomes a bit sluggish after a few days.

Now many people will bite the bullet and restart the computer but if you are using your computer as a server of any kind then this may not be the preferred solution.

How To Restart KDE Plasma 4

Restarting the KDE Plasma desktop is different depending on which version of the desktop you are running.

Press Alt and T at the same time to open a terminal window and enter the following commands:

killall plasma-desktop

kstart plasma-desktop

The first command will kill the current desktop. The second command will restart it.

How To Restart KDE Plasma 5

There are a couple of ways to restart the Plasma 5 desktop.

First of all open a terminal window by pressing Alt and T at the same time.

Now enter the following commands:

killall plasmashell

kstart plasmashell

The first command will kill the current desktop and the second command will restart it.

The second way to restart the KDE Plasma 5 desktop is to run the following commands:

kquitapp5 plasmashell

kstart plasmashell

Note that you don't have to run the commands in a terminal and it may be preferable to try the following:

Press Alt and F2 which should bring up a box where you can enter a command.

Now enter this command:

kquitapp5 plasmashell && kstart plasmashell

This is by far the simplest way and my preferred method for restarting the Plasma desktop.

What Happens When You Run Killall

As this guide shows the killall command allows you to kill all of the processes associated with the name you give it.

What this means is that if you are running 3 instances of Firefox and run the following command then all of the running instances of Firefox will be closed.

killall firefox

This is useful when trying to kill the Plasma desktop because you only want 1 running and the killall command will make sure nothing else is running when you run the subsequent kstart command.

What Happens When You Run KQuitapp5

You can find more information about the kquitapp5 command by running the following in a terminal window:

kquitapp5 -h

This displays the help for the kquitapp5 command.

The description in the help command for kquitapp5 is as follows:

quit a d-bus enabled application easily

Click here to understand what a d-bus enabled application is.

Essentially the KDE Plasma desktop is d-bus enabled and therefore you can provide the name of the application which runs the Plasma desktop to kquitapp5 to stop it. In the examples above the name of the application is plasmashell.

The kquitapp5 command accepts two switches:

  • --service - This overrides the application name and allows you to specify the full name of the service you wish to stop
  • --path - This allows you to specify the path to the d-bus interface to use.

What Happens When You Run KStart

The kstart command allows you to launch applications with special window properties.

In our case we are using kstart simply to restart the plasmashell application.

You can however use kstart to launch any application and you can specify different parameters so that the window shows up in a certain way.

For example you can make the window appear on a certain desktop or on all desktops or you can maximise the application, make it full screen, place it on top of other windows or indeed below other windows.

So why use kstart and not just run the application name? 

By using kstart you are running the plasma shell as an independent service and it is not linked to the terminal in any way.

Try this out. Open a terminal and type the following command:

kquitapp5 plasmashell && plasmashell &

The desktop will stop and restart.

Now close the terminal window.

The desktop will close again.

Don't worry you can easily restart it again. Simply press Alt and F2 and run the following command:

kstart plasmashell

Summary

This shouldn't be something you have to do regularly but it is worth knowing especially if you run the KDE desktop environment on a machine that is turned on for a long period of time.