50

Is It possible In Linux to restart only gui session or os ( i m not talking about restarting pc )

back in windows 98 if u want to restart the gui session or only os u just need to hold down shift key and it will restart the your gui session or only os & it work fine

windows 98 shift + restart

One Zero
  • 27,153
  • 26
  • 88
  • 109

5 Answers5

62

Yes. There a couple of options.

1) You can enable CTRL+SHIFT+BACKSPACE. This three keys will work like CTRL+ALT+SUPR, but they will only restart the GUI.

2) From the command line (press CTRL+ALT+F1 to get to a console) you can restart the Ubuntu display manager (which lets a user login to her preferred GUI) by entering:

sudo service lightdm restart

3) Finally you can restart just unity. It will reset your GUI (all the windows and the bars), but it will not kill any program. After the restart you can continue working where you left it. Enter:

unity --replace

or if you are restarting from the console (after pressing CTRL+ALT+F1), enter:

DISPLAY=:0 unity --replace
Javier Rivera
  • 35,153
10

Traditionally this was accomplished in linux by using ctrl + alt + backspace. This has been disabled a few releases ago and it used to be easily enabled (with the dontzap package).

Nowdays I restart X by using the console and type:

sudo killall Xorg

Then the GUI will restart and you'll get back to your login manager. Make sure to save everything first.

KhaaL
  • 131
  • FYI, if you didn't know: The last few versions have made it easy to enable that key combination in the keyboard layout options (currently in "system settings" -> "keyboard layout" -> "layouts" -> "options..." -> "Key sequence to kill the X server"). – Marty Fried Feb 07 '12 at 20:36
  • Works nicely in Ubuntu-MATE 16.04 – (No preexisting command to assign a shortcut to under »Keyboard Shortcuts«, but since one can assign shortcust custom commands... (⊕Add) – Frank N Jun 27 '18 at 09:00
6

To restart your graphical session, log out and log back in.

If the system is frozen, you can use Ctrl-alt-backspace to log you out (kill your applications).

To do that , see http://ubuntuportal.com/how-to-enable-key-sequence-ctrlaltbackspace-to-kill-server-on-ubuntu-11-10/ which gives you a nice graphical walk through.

If you simply want to restart the window manager, without logging out, it depends on the window manager.

For Unity see

How do I restart the window manager?

For gnome you hit Alt + F2 and in the dialog enter r and Enter

Panther
  • 102,067
1

I tried to reinstall (sudo apt install --reinstall ...) a lot of packages about Xorg, GNOME, graphics card (by the way my graphics card is a MGA200 on a Dell R815), without solving the problem.

Finally, the combination Ctrl+Alt+F1 to get to a console and restart the display manager by running sudo service gdm restart worked.

1

If you are running Kubuntu and all your window decorations have disappeared and the task-bar doesn't work, you will probably feel that your GUI session has died. You can restart it while preserving all your running programs if you already have a shell open. Just type:

kwin --replace &
SuB
  • 4,229
  • 5
  • 24
  • 33