Shutting down your Debian machine cleanly
Posted by Steve on Fri 11 Feb 2005 at 13:33
Rather than simply removing power from your Debian machine you should shut it down cleanly, this means that the filesystem will not get confused or messed up and all your files will be intact.
There are several ways to shut down your Debian machine cleanly, with the most simple probably being from the GUI environment you are using (if you have one).
For the GNOME desktop enviornment there is the option to shutdown the machine which is immediately available when you click "Logout". Choosing this should log you out of the desktop and also shut the machine down.
From the console, either a remote SSH session or from in front of the machine you also have access to the following commands:
The second command will take no arguments and immediately begin shutting down the machine, simply run as root :
If your machine supports "poweroff" then it will be shutdown and the power turned off, this usually requires that you've setup power management - this can be as simple as running:
or it might be more complex.
The shutdown command is more configurable, it allows you to specify whether you wish to reboot or shutdown, and will also allow you to schedule the action for later. Generally the usage is:
shutdown -r now
Here "-r" means to reboot, and "now" is the time to carry that activity out. If you wished to shutdown your machine at 8pm you could instead run:
This will pause until 8pm and then shutdown - pressing Ctrl + C will cancel the shutdown, as will running another copy of shutdown with the "cancel" flag:
Debian machines are typically setup so that if you press the three-fingered-salute "Ctrl + Alt + Delete" they will reboot. This is specified by the following line in the file "/etc/inittab".
# What to do when CTRL-ALT-DEL is pressed. ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
This command can be changed to anything else you desire such as:
# Poweroff on Ctrl + Alt + Del ca:12345:ctrlaltdel:/sbin/poweroff
# Ignore it completley ca:12345:ctrlaltdel:/bin/echo "Three Finger Salute Ignored"