Auto shutdown your computer in Linux

When going to sleep I sometimes like to leave my computer on playing ambient music from an internet radio station. It’s a really good intro to the dreams.

However I don’t want to have the computer play and be turned on all the time so I use a simple auto shutdown program to set the amount of time in which it should shut itself off.

There are two relatively similar and simple programs that do that, one suitable for KDE and another for GNOME (or Xfce). Both sit in your tray and count the time.

KShutdown

KShutdown allows you to set the exact date and time or “time from now” which is what I and likely you will want. Just set the time in hours or minutes and click ok. You can also set it to initiate when a certain application you select closes which may come in handy sometimes as well.

In addition to auto shutdown you can also set it to auto restart, hybernate, suspend (sleep), lock screen or logout. Even that’s not all though. There’s also an “extras” option which allows you to set a specific command such as stopping a particular program or terminate a connection. You can add more programs available for auto stopping as well.

GShutdown

GShutdown also allows you to set the date and time or time from now that has to pass for auto shutdown to be initiated and it can initiate auto restart or logout (end session) as well. It doesn’t have the option to sleep or hybernate however.

In preferences you can select the method of shut down which may depend on which desktop environment (KDE, GNOME or Xfce) or display manager (kdm or gdm) are you using. You can also specify the exact command it should initiate before executing the auto shutdown, restart or logout.