shutdown or restart linux
-a Use /etc/shutdown.allow. -t sec Tell init(8) to wait sec seconds between sending processes the warning and the kill signal, before changing to another run- level. -k Don't really shutdown; only send the warning messages to every- body. -r Reboot after shutdown. -h Halt or poweroff after shutdown. -H Halt action is to halt or drop into boot monitor on systems that support it. -P Halt action is to turn off the power. -n [DEPRECATED] Don't call init(8) to do the shutdown but do it ourself. The use of this option is discouraged, and its results are not always what you'd expect. -f Skip fsck on reboot. -F Force fsck on reboot. -c Cancel an already running shutdown. With this option it is of course not possible to give the time argument, but you can enter a explanatory message on the command line that will be sent to all users. time When to shutdown.
shutdown -r time "message" The recommend and secure way to shutdown Linux desktops, Laptops, routers, and server is to use the shutdown command. Another option is to use halt or poweroff command. The syntax is as follows for the shutdown command:
shutdown -h time "message"
- -h : Poweroff the system.
- time : When to shutdown. You can poweroff immediately or after 2 minutes. It can be an absolute time in the format hh:mm, in which hh is the hour (1 or 2 digits) and mm is the minute of the hour (in wo digits). Second, it can be in the format +m, in which m is the number of minutes to wait. The word now is an alias for +0.
- message: Send warning message to send to all users.
Steps to shutdown the system
First, open a command-line terminal (select Applications > Accessories > Terminal). For remote system, login using ssh. Next, switch to the root user by typing su - or sudo -s and entering the root password, when prompted. Finally, type the following command to shutdown system immediate as root user:
# shutdown -h now
# shutdown -h +0
Task: Shutdown with warning message
To shutdown system in 10 minutes with the following warning message:
# shutdown -h +10 "Development server is going down for maintenance. Please save your work ASAP."
Broadcast message from root@wks01 (pts/0) (Sat Apr 21 02:26:30 2012): Development server is going down for maintenance. Please save your work ASAP. The system is going DOWN for system halt in 10 minutes!
Say hi to poweroff command
You can halt the system, switch off the power. This is called as poweroff and poweroff command can be used as follows (warning: the following command will immediately shutodown the Linux system):