Shutting down a Linux system is a bit tricky. Remember that you should never just turn off the power or hit the reset switch while the system is running. The kernel keeps track of disk I/O in memory buffers. If you reboot the system without giving the kernel the chance to write its buffers to disk, you can corrupt your filesystems.
Other precautions are taken at shutdown time as well. All processes are sent a signal, which allows them to die gracefully (writing and closing all files, and so on). Filesystems are unmounted for safety. If you wish, the system can also alert users that the system is going down and give them a change to log off.
The easiest way to shutdown is with the shutdown command. The format of the command is
The argument is the time to shutdown the system (in the format hh:mm:ss), and is a message displayed on all user's terminals before shutdown. Alternately, you can specify the as ``now'', to shutdown immediately. The -r option may be given to shutdown to reboot the system after shutting down.
For example, to shutdown the system at 8:00pm, use the command
# shutdown -r 20:00
The command halt may be used to force an immediate shutdown, without any warning messages or grace period. halt is useful if you're the only one using the system, and want to shut down the system and turn it off.
Don't turn off the power or reboot the system until you see the message:
The system is halted
It is very important that you shutdown the system ``cleanly'' using the shutdown or halt commands. On some systems, pressing will be trapped and cause a shutdown; on other systems, however, using the ``Vulcan nerve pinch'' will reboot the system immediately and may cause disaster.