Most of the popular Operating systems out there allow you to shut down your PC or laptop from different methods. Linux operating systems also allow such ways for a user to safely shutdown, reboot, hibernate or suspend your PC. Before now, you have shut down your PC from very obvious options like through hitting your PC’s power button or using the power button on the desktops toolbar. Linux was manipulated by command line when it first came out for users and once you get used to the commands, it is the easier and safer way to get things done on your PC.
Shutting down or rebooting your PC is important for every operating system for keeping things working as normal. Shutting down your PC through command line is a secure way as it notifies all the logged in users that the system is about to go off. Shutting down your PC in through terminal is customizable, as you can even tell your OS when to trigger the Shutdown option by scheduling it. So in this article, I will guide you on how to shut down or Reboot Ubuntu 18.04 through command lines.
Command for Shutdown in Linux Ubuntu 18.04
The shutdown command in Ubuntu 18.04 can be used for the option given below:
Below is the command syntax that is used in the terminal to shut down and restart Ubuntu 18.04
Shutdown [OPTIONS…] [TIME] [WALL…]
The first argument of [OPTIONS] can be a time string (commonly used as “now”). Usually, after the [OPTIONS] argument, wall message is optionally used to notify the users who are logged in, so that they can safely save the work before the system goes down. For the [TIME] argument this will specify what time the command will be executed for the shutdown of the system. The format that is used is “hh:mm” (hours/minutes) which is recommended to be a 24-hour format. Alternatively, you can use “+m” where “m” indicates minutes, which will refer to the specified number of minutes you want the system to be shut down from now.
For triggering an immediate shutdown of your Linux system you can use “now” in the [TIME] syntax which is an alias for “+0”. Linux as default implies 1 minute if you don’t specify the time in the shutdown command. Keep in mind that for specifying wall message you must declare the time argument. If you imply the time in shutdown command a /run/nologin file will be generated 5 minutes before the system goes down just to make sure that no further users can log in the system.
Using Shutdown Commands in Ubuntu 18.04
The run the shutdown command for Ubuntu 18.04, open up the terminal and follow the commands given below which will guide you how to use them.
To shut down your PC in Ubuntu us safe way, use the command below:
To perform the safest way to shut down your Ubuntu 18.04, type in the following command and hit enter:
This command will not shut down your Ubuntu instantly when you execute it but will set a minute timer before shutting down so you can save your work in the meantime.
To shut down your PC immediately type in the following command and hit enter:
To perform the instantaneous way to shut down your Ubuntu 18.04, type in the following command and hit enter:
To shut down your PC on a dedicated time, type in the following command and hit enter:
Note: Remember the Linux follows the 24 hours format so in hh:mm type in hours in hh and minutes in mm.
To shut down after few minutes or hours, type in the following command and hit enter:
If you want to shut down your Ubuntu after a few minutes or hours, use the following command:
Note: Bear in mind that “m” here indicates minutes. Just replace “m” with the number of minutes you want your Ubuntu to execute the shutdown command.
Use the following command to display a wall message to the users who are logged in to the PC before the system shuts down.
Using Restart Commands in Ubuntu 18.04
Use the following command to reboot/restart your Ubuntu in a safe way
This command above will not reboot your Ubuntu instantly when you execute it but will set a minute timer before restarting so you can save your work in the meantime.
Use the following command if you want to restart/reboot your PC instantly:
To schedule the restart for your PC, type in the following command and hit enter:
Use the following command if you want to schedule the time to restart your PC:
To restart after few minutes or hours, type in the following command and hit enter:
Use the following command if you want your PC to restart after a few minutes or hours:
Note: Remember that “m” here indicates minutes. Just replace “m” with the number of minutes you want your Ubuntu to execute the reboot command.
Use the following command to display a wall message to the users who are logged in to the PC before the system restarts.
Use the options given below to apply the following conditions to the shutdown command.
- -P (-power-off): this option is like halt, use in shutdown command to Power-off the system (also turns off unit).
- -r (-reboot): use this option in Shutdown command to reboot the system.
- -h (-halt): use this option to halt the system after terminating processes.
You can also shut down the using the halt and power-off options using the following command
Following examples shows you how to use power-off and halt options in the shutdown command.
For power-off option in shutdown command, use the following:
For halt option in shutdown command, use the following:
Note: After using the options arguments in the above examples, you can also declare the Time and Wall arguments.
Canceling a Scheduled Shutdown in Ubuntu 18.04
If you have scheduled the time of shut down or restart of your Ubuntu system through shutdown command, you can cancel that scheduled shutdown or reboot by entering the following command before it reaches the time of execution.
The command above will cancel the scheduled shutdown or restart instantly. If the scheduled time in invocated as “+0” or “now” in the shutdown command then you cannot use the above option for canceling the shutdown command.
That’s it! Hope this helped you to know how to shut down or reboot your Ubuntu 18.04 from the terminal by using Shutdown commands. If you have any confusion or experienced any difficulty in following the instructions, please let us know in the comments section below.