This tutorial explains Linux “shutdown” command, options and its usage with examples.
Description:
shutdown brings the system down in a secure way. All logged-in users are notified that the system is going down.
It is possible to shut the system down immediately or after a specified delay. All processes are first notified that the system is going down by the signal SIGTERM.
This gives programs like vi the time to save the file being edited, mail and news processing programs a chance to exit cleanly, etc. shutdown does its job by signalling the init process, asking it to change the runlevel.
Runlevel 0 is used to halt the system, runlevel 6 is used to reboot the system, and runlevel 1 is used to put to system into a state where administrative tasks can be performed; this is the default if neither the -h or -r flag is given to shutdown.
Synopsis :
shutdown [OPTION]… TIME [MESSAGE]
TIME may have different formats, the most common is simply the word ‘now’ which will bring the system down immediately. Other valid formats are +m, where m is the number of minutes to wait until shutting down and hh:mm which specifies the time on the 24hr clock.
OPTIONS:
-r
Requests that the system be rebooted after it has been brought down.
-h
Requests that the system be either halted or powered off after it has been brought down, with the choice as to which left up to the system.
-H
Requests that the system be halted after it has been brought down.
-P
Requests that the system be powered off after it has been brought down.
-c
Cancels a running shutdown. TIME is not specified with this option, the first argument is MESSAGE.
-k
Only send out the warning messages and disable logins, do not actually bring the system down.
-f
Skip fsck on reboot.
-F
Force fsck on reboot.
Examples :
1. Halting with a custom message
$ shutdown -h now 'System is going down now' Broadcast message from @ (/dev/pts/1) at 1:36 ... The system is going down for halt NOW! System is going down now
2. Scheduling a reboot :
$ shutdown -r 20:00 Broadcast message from @ (/dev/pts/1) at 10:27 ... The system is going down for reboot in 573 minutes!
Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.
- Apply for Programming Internship
- Check Information Technology Books
- Practice Programming MCQs
- Check Linux Books