Linux Server Admin Tools and GNU Benchmark Tools Directory, OpenSource Tools

Shutdown / Rebooting Linux System

Linux can be either shutdown/reboot in hard and soft ways. The hard way is always dangerous as it may corrupt the file system always a soft or clean shutdown/reboot is advisable.

 

Soft-way of Shutdown / Rebooting

 

To shutdown the computer immediately (don’t power down). Note that in UNIX systems this kind of shutdown means to go to ” single−user mode”. Single−user mode is a mode where only the administrator (root) has access to the computer, this mode is designed for maintenance and is often used for repairs. For example this would take you to single user mode

 

 

To Shutdown (−h = halt) the computer immediately. It begins the shutdown procedure, press CTRL−C (break−key) to stop it. After the end of the command you can also leave a message in quotation marks.

 

 

To broad−casted the message to all users, for example.

 

 

To Shut down at a particular time.

 

To Reboot at a particular time

 

 

Shutdown −h vs poweroff

 

On some systems, shutdown −h and halt do not actually turn the system’s power off. On systems that do not power off with these commands use the poweroff command

 

To reboot the Linux system

 

 

Shutdown ( −r = reboot) the computer immediately. It begins the reboot procedure, press CTRL−C to break it.

 

To reboot with a message.

 

 

Same as the shutdown −r now the following command works soft rebooting the system

 

 

CTRL−ALT−DEL (key−combination)

 

May be used from a terminal to reboot or shutdown, it depends on your system configuration. Note that this doesn’t work from an xterminal. CTRL−ALT−DEL begins the reboot/shutdown immediately, the user does not have to be logged in.

 

To disable CTRL−ALT−DEL from rebooting your computer (or to have it do something different), you can edit the/etc/inittab file (as root).

 

# Trap
CTRL−ALT−DEL
ca::ctrlaltdel:/sbin/shutdown −t3 −r now

 

You could also change the command it runs for example if you changed the −r to a −h the computer would turn off instead of rebooting, or you could have it do anything you want. It’s up to your creativity to make it do something interesting.

 

Hard-way of shutdown / rebooting

 

We can do this by making use of the kernels sysrq-trigger magical key. WARNING : Following may lead to data loss or file system corruption so use at your own risk.

 

Enable the sysrq-trigger kernel variable.

 

 

And then use the following command to trigger the hard reboot.

 

 

To shutdown the system instently

 

 

Always use sync command before trying the above options.