A system shutdown is a shell script that properly prepares a system with multiple users to be turned off or rebooted. An improper shutdown can have undesirable results on the file system. On a single-user system, shut down when your system needs servicing, when you are going to move your computer, or when you cannot reboot.
From the user's viewpoint, shutting down a system is simple, but from the system's viewpoint, the shutdown process actually involves a series of events designed to preserve file integrity.
There are several controlled situations when you may want to shut down your system:
The shutdown command is the safest and most thorough way to halt the operating system. When you designate the appropriate flags, this command notifies users that the system is about to stop operations, terminate all existing processes, unmount file systems, and shut down the system.
The steps that take place during a system shutdown depend on how the system was customized. The shutdown described in this section may not appear exactly the same on your system.
Note: You must have root user authority to shut down the system.
shutdownThe system shuts down; the system waits one minute before stopping the user processes and the init process. You will see the following message:
shutdown completed...
When the -r flag is specified with the shutdown command, the system reboots after it completes the shutdown.
In some cases, you may need to shut down the system and enter single-user mode (also referred to as maintenance or standalone mode) to perform software maintenance and diagnostics.
cd /
You must be in the root directory to shut down the system to single-user mode. This ensures that file systems are unmounted cleanly.
shutdown -mThe system shuts down to single-user mode. A system prompt displays, and you can perform maintenance activities.
You can also use the shutdown command to shut down the system under emergency conditions. Use this procedure to stop the system quickly without notifying other users.
shutdown -F
The -F flag instructs the shutdown command to bypass sending messages to other users and shut down the system as quickly as possible.