Shutting down the Linux systems can be done in different ways. We can use provided GUI like KDE, GNOME, Unity ect. to shutdown system. But what will we do if we have only console access to the system. We can use
shutdown command to shutdown and reboot system.
shutdown [OPTIONS...] [TIME] [MESSAGE...]
We can use
shutdown command without providing any option or parameter to simply shutdown the system. We need required privileges like root to shutdown a linux system.
Shutdown At Specified Time
Sometimes we need more time before shutting down the system. We can provide some interval before the shutdown command take effect with the time value
In this example we will shutdown the system after 5 minutes now.
$shutdown -h 5
We can restart the Linux system with shutdown command. This will first shutdown system and then restart. We should provide
-r option which means restart.
Restart At Specified Time
We can also restart the system at specified time. We will use
-r option again by adding the interval value we want to wait. In this example we want to restart the system after 10 minutes.
$ shutdown -r 10
Skip File System Check (fsck) at Reboot
Linux operating systems generally check a file system at start if there is some problems. This file system check may take some time. We can skip this file system check with
$ shutdown -r -f
Send Message To System Users
Linux operating system is designed to work multi user. At given time there may be more than one user connected to the Linux system. Shutting down will interrupt their connection and work too. We can send some message with
shutdown command. As stated in syntax the message it the last part of the shutdown command.
In this example we will send message
This system will shutdown in 5 minutes
$shutdown 5 "This system will shutdown in 5 minutes"
We have alternative command to reboot the Linux system. We can simply use
reboot command for this.