Adverts
Cleanly shutting down Debian Linux can be performed in a number of different ways and to some extent depends on whether you are using a graphical user interface (such as KDE or Gnome) or the command line.
Windowing environments, for instance KDE and Gnome, generally provide a way to shut down and reboot the computer from within the environment. Users of other popular graphical operating systems such as Windows and MacOs will no doubt be familiar with this system. KDE, for instance, pops up a dialog offering the user the option of logging out, shutting down or restarting after the K menu is expanded and Log out... has been selected.
Debian Linux can also be shut down from a command prompt using the command
shutdown
This command can be issued either at a local terminal or remotely using an SSH login (or telnet login if you must). Remote shut down can be useful sometimes – especially it X locks up and freezes the local keyboard.
The shutdown command takes a number of options and can generally only be issued by root although it is possible to configure it so that any user can issue a shut down command. The most commonly used options for shutdown are -r and -h which indicate reboot and halt after shutdown respectively. The shutdown command also requires a time to perform the shut down. This can be an absolute time such as 19:00 or a delay such as 20 minutes you can also use now which does exactly what you would expect it to do.
To reboot your computer therefore you would use a command such as this
shutdown -r now
A quick word of warning at this point. If you forget to specify -r or -h your machine will shut down but probably not in the way you expect if you are used to Windows. On Windows a plain shut down means turn off, or halt, the computer. On Linux a plain shut down means switch to run level 0. Run level 0 is where essentially nothing but the kernel is running. If you actually wanted to halt the computer you need to then log in as root and issue a halt command.
If you schedule a shutdown for a future date it can be cancelled with the -c option (to which you don't add a time argument).
Finally, most Debian machine will be configured such that at a command prompt pressing crtl+alt+delete will invoke shutdown and reboot. The man page for shutdown describes how to change this behaviour. Note that crtl+alt+delete won't necessarily work in a windowing environment because X captures all keystrokes and the currently running windowing environment might not map this key combination to shutdown (KDE provides the shut down dialog).