Different ways to Shutdown or Reboot Your Linux System (Ubuntu)
There are four different methods to shutdown or reboot your Linux System (Ubuntu).
*Shutdown or reboot is an Administrative task , so it require root privileges before you execute these commands.
*In Ubuntu you gain root privilege by writing sudo before any command.
Different ways to Shutdown or Reboot
1. By using init command.
Syntax
sudo init runlevel
* 0 - halt
* 6 - Reboot
If we write
sudo init 0 //shutdown and halt the system , it is like shutdown in windows.
sudo init 6 //shutdown and reboot the system , it is like restart in windows.
*There are 7 different runlevel in linux from 0 to 6 so don't use other number with init if you are not sure about it.
2. By using shutdown command.
Syntax
shutdown [-option] time
Example
--> sudo shutdown -h now //shutdown and halt the system , it is like shutdown in windows.
* now means 0 sec so above command shutdown your system immediately after you typed the command.
* instead of now you can specify time also.
* -h means halt
--> sudo shutdown -r now //shutdown and reboot the system , it is like restart in windows.
* -r means reboot .
3. reboot command : reboot command shutdown and restart the system.
Example
sudo reboot //shutdown and reboot the system , it is like restart in windows.
4. halt command : halt command shutdown and halt the system.
Example
sudo halt //shutdown and halt the system , it is like shutdown in windows.
*In Ubuntu halt -h work same as halt does .
There are four different methods to shutdown or reboot your Linux System (Ubuntu).
*Shutdown or reboot is an Administrative task , so it require root privileges before you execute these commands.
*In Ubuntu you gain root privilege by writing sudo before any command.
Different ways to Shutdown or Reboot
1. By using init command.
Syntax
sudo init runlevel
* 0 - halt
* 6 - Reboot
If we write
sudo init 0 //shutdown and halt the system , it is like shutdown in windows.
sudo init 6 //shutdown and reboot the system , it is like restart in windows.
*There are 7 different runlevel in linux from 0 to 6 so don't use other number with init if you are not sure about it.
2. By using shutdown command.
Syntax
shutdown [-option] time
Example
--> sudo shutdown -h now //shutdown and halt the system , it is like shutdown in windows.
* now means 0 sec so above command shutdown your system immediately after you typed the command.
* instead of now you can specify time also.
* -h means halt
--> sudo shutdown -r now //shutdown and reboot the system , it is like restart in windows.
* -r means reboot .
3. reboot command : reboot command shutdown and restart the system.
Example
sudo reboot //shutdown and reboot the system , it is like restart in windows.
4. halt command : halt command shutdown and halt the system.
Example
sudo halt //shutdown and halt the system , it is like shutdown in windows.
*In Ubuntu halt -h work same as halt does .
If You Liked This Post Please Take a Time To Share This Post
0 comments:
Post a Comment