Mar 30 2007
LCoTD: Shutdown
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
Today I’ll cover logging out of Linux and Shutting down Linux from the shell.
|
|
To logout via the shell interface, you simply type logout or exit. Easy as that.
Never simply turn off the power to a Linux system: it needs a more graceful shutdown. To perform a shutdown from a shell, run the shutdown command, as the superuser, as follows:
$ sudo shutdownA few facts about the shutdown command
- Located in /sbin
- Installed with the SysVinit RPM
- Accepts alternate output arguments
With no options, shutdown puts the system into single-user mode, a special maintenance mode in which only one person is logged in (at the system console), and all nonessential services are off. To exit single-user mode, either perform another shutdown to halt or reboot, or type ^D (Ctrl + D) to bring up the system in normal, multiuser mode.
Useful Options
-r Reboot the system.
-h halt the system.
-k Kidding: don’t really perform a shutdown, just broadcast warning messages to all users as if the system were going down.
-c Cancel a shutdown in progress (omit the time argument).
-f On reboot, skip the usual filesystem check performed by the fsck program.
-F On reboot, require the usual filesystem check.
Usage
shutdown accepts two types of time input: absolute and relative. For example,
$ sudo shutdown -h +10 "scheduled maintenance"will broadcast the message “The system will shutdown in 10 minutes (scheduled maintenance)” and the system will halt in 10 minutes.
You can also use an absolute time to define shutdown, like so:
$ sudo shutdown -rF 13:30 "Rebooting"This will broadcast that the message “The system will shutdown at 13:30 (Rebooting).” At 13:30 (1:30pm), the system will reboot and perform a filesystem check.
For technical information about shutdowns, single-user mode, and various system states, see the manpages for init and inittab:
$ man init$ man inittabIf you found this article useful and use StumbleUpon, please give it a
thumbs up so more people can read it! Thank you!
Please take the time to check out this thread and leave a comment letting me know what you would like to see from this site. It's still relatively young and trying to find its way- you can make design pitstop the resource you always wanted!
