I can restart my desktop from a console window (Ctrl+Alt+F1) with this command:

sudo service lightdm restart

This will present a fresh login screen and closes all programs running on the desktop. This it not what I want.

I want a command or a script that restarts the desktop from a console while keeping all applications running, so I can access their windows when I get back the desktop screen.


I keep having problems with the desktop blacking out while the computer remains running fine. There are 9,286 posts with "black screen" with different causes. Some with solutions like this, some without. I am working with many Xubuntu computers and had it happen multiple times.

While causes differ, (in my cases) the symptom is often the same. It usually helped to restart lightdm, but I was losing my data and had to restart all applications. Now I had the problem when testing VGA matrix switches. Every time I reconnected my monitor, I had to reset lightdm. So I learned that what I need is a better workaround. Something analogous to restarting explorer.exe with the Windows Task Manager. This solves every hang up of the desktop but does not affect running programs (it basically restarts the desktop).

System: Xubuntu 16.04 64-bit, PC laptop

  • Thinking out loud....Would running these programs in Docker solve your issue since you can't find the Root cause of the "blacking out"? – EODCraft Staff Oct 17 '18 at 11:11
  • @EODCraft Staff can you a bit more specific on why that can help. Maybe I do not know enough about Docker... – CatMan Oct 18 '18 at 13:28
  • Just Google Docker...It's got amazing potential and is very light-weight. "Docker is a computer program that performs operating-system-level virtualization, also known as "containerization". It was first released in 2013 and is developed by Docker, Inc. Docker is used to run software packages called "containers". I think...even if you log out, the containers continue to run...At least my Server does I have in Docker.... – EODCraft Staff Oct 18 '18 at 23:52
  • This woiuld not solve the problem, I guess. If I ran all apps in docker containers, how would I restart the desktop then? We are not talking about command line here, but desktop. Run LibreOffice as docker container and type a letter without saving it. Then restart lightdm and continue your letter. Can you walk me though that example? – CatMan Dec 16 '18 at 21:07

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.