Ubuntu 24.04 LTS new install
Gnome, X11, dash-to-panel plugin
I have SSD & HD in my pc, most of my apps’ data are stored on the HD, therefore each time before shutdown, I have to close all opened apps, otherwise, I might get error messages due to forced app closure. Is there a command to do this or it has to be done through script? Currently I’m using ‘wmctrl -c :ACTIVE:’ command to close each app,
To gracefully close all opened applications on Ubuntu with GNOME, you can use the gnome-session-quit command. This command can be used to log out or shut down the current session, which will close all running applications without user confirmation. For example:
gnome-session-quit --logout --no-prompt
And you already know about wmctrl
, and I’ll bet even the killall <app name>
but I prefer this on killall:
killall -SIGTERM <ApplicationName>
For a more automated approach, you can create a script that combines these methods to close all applications before a shutdown or logout. This can be particularly useful if you want to ensure all applications are closed before the system shuts down.
Remember to test these commands in a safe environment to ensure they work as expected for your specific use case.
EDIT1: Remember that forcefully closing applications (using SIGKILL) can lead to file corruption and OS breakage, so it’s best to use graceful termination methods whenever possible.
I have suggested x-tile in another discussion a few minutes ago. While I have x-tile open I see that all or selected app sessions can be closed.
@1fallen thanks for this tip, I remembered I tested this solution awhile ago, and it did not save unsaved apps due to the no prompt flag.
@dragonfly41 thanks for this tip and solution.
TBH This is the first I’ve heard of the application. (x-tile)
Reading up on it is interesting, but I just use my system differently is all.
It seems very useful though.
x-tile is developed by the same creator of CherryTree … another tool recommended where hierarchical notes and blocks of code can be weaved together. Truly a gem. I use it as “Houston control” for various workflows.
@dragonfly41 you do come up with some gems.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.