Answers in this question only work if one can type the commands inside active KDE session. In another tty, kstart complains that it can't open display.

How to restart KDE from tty2? How does kstart find the display? Can I set up DISPLAY environment variable or something like that?

  • Did any of the answers help?
    – Sparhawk
    Feb 10, 2019 at 20:51

3 Answers 3


You can find the display the GUI session is running on with the who command.

To send output to a display from another local session, prepend the command with DISPLAY=:n, where n is the number of the display.

You can also set a session environment variable with export DISPLAY=:n if you have several commands you need to send to that display.


If KDE is running on tty1, it's likely :0, i.e. the command to run is:

DISPLAY=:0 plasmashell

FWIW, I'm frequently restarting plasmashell, so I wrote the following script. It rebuilds the plasmashell database, then kills the old plasmashell instance in increasing levels of severity.

timeout 5 kquitapp5 plasmashell
pgrep -U $USER -x plasmashell &>/dev/null && pkill -U $USER -x plasmashell
pgrep -U $USER -x plasmashell &>/dev/null && pkill -U $USER -x -9 plasmashell
pgrep -U $USER -x plasmashell &>/dev/null && echo "ERROR: cannot kill plasmashell"
plasmashell &

N.B. if you want to adapt this for usage from another tty, you can kill the previous plasmashell without defining DISPLAY. It's just starting the new instance that needs the variable.

  • 1
    Sorry @DKBose, I don't use Ubuntu any more.
    – Sparhawk
    Apr 23, 2019 at 5:39

You can kill the process running Plasma and then the login screen should start again. Example for plasmashell version 5.26.2:

killall startplasma-x11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .