Wednesday 11 September 2013

How to turn off, restart, and shut down Linux

Question

How to turn off, restart, and shut down Linux.

Answer

Shutting down, rebooting the computer from the shell or command line

Below is a listing of each of the commands that will enable a user to shut down, turn off, reboot, etc. their Linux computer from the command line. Users can find additional information about each of the commands by clicking the link.


Shutting down or rebooting the computer from a GUI interface

Shutting down or rebooting the computer from a GUI interface depends on what GUI you are using. Often the shutdown, log out, reboot, etc. are located through the GUI's main menu or bar located on one of the sides of the window. If you are unable to find a method of shutting down or rebooting the computer remember you can shut down or reboot the computer using the above commands in a shell, you could also create scripts that would run these commands from the GUI.

About halt, poweroff and reboot

Stop the computer.

Syntax

halt [-l] [-n] [-q] [-y] or
halt [-n] [-w] [-d] [-f] [-i] [-p] [-h]

reboot [-n] [-w] [-d] [-f] [-i]
poweroff [-n] [-w] [-d] [-f] [-i] [-h]


-d Don't write the wtmp record. The -n flag implies -d.
-h Put all hard drives on the system in standby mode just before halt or poweroff.
-i Shut down all network interfaces just before halt or reboot.
-l Suppress sending a message to the system log daemon, syslogd, about who executed halt .
-n Prevent the sync before reboot or halt.
-p When halting the system, do a poweroff. This is the default when halt is called as poweroff.
-q Quick halt. No graceful shutdown is attempted.
-r Force halt or reboot, don't call shutdown.
-y Halt the system, even from a dialup terminal.
-w Don't actually reboot or halt but only write the wtmp record (in the /var/log/wtmp file).

Examples
#halt Set the computer to a mode that enables a user to turn off the computer.
#poweroff Stop the processor (if you have proper permission).

About Shutdown

Turn off the computer immediately or at a specified time.

Syntax

shutdown [-a][-t sec][-krhnfFc][time][warning-message]

-a Use /etc/shutdown.allow.
-t sec Tell init to wait sec seconds between sending processes the warning and the kill signal, before changing to another runlevel.
-k Don't really shutdown; only send the warning messages to everybody.
-r Reboot after shutdown.
-h Halt after shutdown.
-n Don't call init to do the shutdown but do it ourselves. 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 an explanatory message on the command line that will be sent to all users.
time When to shutdown.
warning-message Message to send to all users.

Examples
#shutdown 8:00 Shutdown the computer at 8-oclock

1 comment:

  1. Good to know about this process of linux i think this will be the great lessons for the beginners of linux.

    ReplyDelete