I am new to xubuntu, somtimes my xfce desktop crashes, and I can only use tty1 from command line.

I want to know how can I restart my xfce in tty7 from tty1?

I've googled it, but didn't found the solution. Thanks.

4 Answers 4


For me startxfce4 didn't work, but pkill did.

You could try the following command:

xfwm4 --replace

It restarts the windows manager.

  • 1
    Yeah. This is, first try to reload window manager, if don't work try restarting login service, and in the worst of cases, kill your user then start again your work :)
    – m3nda
    Oct 23, 2015 at 4:20
  • 1
    Exactly. Don't forget to append a &: xfwm4 --replace & Jan 27, 2017 at 2:02

pkill worked but seemed a little extreme to me. If I had other stuff going on in other tty sessions, it would kill those too.

Another solution is:

sudo systemctl restart lightdm

A great strength of Linux is that there are always multiple ways to achieve the same task.

  • --replace does try to save things :)
    – m3nda
    Oct 23, 2015 at 4:20
  • 1
    Ubuntu16 use sudo service lightdm restart.
    – jc__
    Aug 9, 2018 at 17:54
  • I didn't try pkill. When I tried xfwm4 --replace (from other answers), it threw a GTK3 error from the command line. I tried this, and it worked great. Thanks Alan.
    – Mike
    Apr 5, 2020 at 23:28
  • 1
    it somehow exited my running apps
    – 16851556
    Oct 21, 2020 at 14:44
  • 1
    Beware: systemctl restart lightdm kills the session and logs you out.
    – dvo
    Feb 10 at 10:34

Try killing user by

pkill -KILL -u yourusername

This will bring you back to login screen though.

  • Sometimes lose current windows is not a choice :X, u can do same restarting ldm service ( or the login manager you have ). Killing every process of a user it's the last option, because you may be working on tty1 and you will kill it too. Login manager (wich is x based) would not close other sessions.
    – m3nda
    Oct 23, 2015 at 4:20

You can try startxfce4.

As this site says:

Restart XFCE4 : from the command line, you would better use "startxfce4" to bypass stupid distribution X startup scripts that can drive you crazy, really.

  • 3
    That's the start XFCE4, not to to restart it. When I ran startxfce4 I got these messages: /usr/bin/startxfce4: X server already running on display :0.0 xfce4-session: Another session manager is already running
    – Enkouyami
    Jul 4, 2015 at 21:43
  • I get "xinit: unable to connect to X server: Connection refused"
    – kurdtpage
    May 20, 2018 at 10:47
  • 1
    good luck fixing login loop afterwards: askubuntu.com/a/223634/308869
    – Ufos
    Apr 4, 2019 at 13:15
  • @Enkouyami well, when something crashes Restart = Start. You got the message already running because your xfce4 was not crashed ;)—this is a linguistic issue. Anyway, this answer fits the question. :) Aug 27, 2019 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.