Shutdown Ubuntu From Terminal : Linux Command Guide

In this tutorial which is targeted for Beginner Linux users, we are going to show you the command to shutdown Ubuntu From Terminal.

Shutdown Ubuntu From Terminal : Linux Command Guide

Shutdown Command Format

shutdown [-akrhPHfFnc] [-t sec] time [message]

Options

-a Control access to the shutdown command.
-r Reboot the system.
-k It doesn’t perform the shutdown but send the warning messages as if the shutdown were real.
-h Shut down and then halt.
-P It instructs the system to power down after shutting down.
-c Cancel a pending shutdown.
-f System won’t start fsck function after reboot.
-F Force fsck after reboot.
message Custom message which can be used to aware the users regarding shutdown.

Command Example

To shutdown Ubuntu, you need to run the command:

$ sudo shutdown -h now

Note: “h” refers to halt which means to stop. “now” is a time parameter which means that system is going to shutdown right now.

In the command below, we will show you the command to set time parameter in minutes or hours also. Open your terminal and run the following command:

$ sudo shutdown -h +10 "System is shutting down in a while, Please save your work."

Restart Command

Interestingly, there is no separate command for restart as the shutdown command can be used to restart a system. There is trick here as you need  to use  r option instead of the h option.

Run the following command in your terminal to restart your system.

$ sudo shutdown -r +5 "System will restart in 10 minutes."

Cancel Shutdown Command Operation

At this point a shutdown can be canceled by calling shutdown with “c” option.

$ sudo shutdown -c

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *