How to use the shutdown command in Ubuntu 20.04

The Shutdown is a command that you give to your operating system (OS) to turn it off completely. When your computer system is shut down, it no longer consumes any power, and all operating programs have been terminated. Frequently shutting down your system is highly recommended as it has lots of advantages. Some of them are mentioned below:

  • Leaving your computer on for an extended period will put a lot of strain on your system components like processor, ram, hard disk, etc., and reduce their lifespan. By turning it off, you are allowing your system to clean everything and start over.
  • Your system drivers can crash or malfunction, such as graphic cards, printers, monitors, or other drivers. Shutting down your computer every day offers your system an opportunity to repair any problems and correctly reboot the driver.
  • Programs can sometimes consume too much memory, causing your system to slow down or even freeze due to memory hogging. This process will be eliminated when you shut down your computer, giving you a smoother and quicker experience.
  • When you leave your system for an extended period, it may be subjected to power spikes or unscheduled load-shedding, resulting in the loss of unsaved data.

How to use the shutdown command in Ubuntu 20.04

Now, as you understand the benefits of shutting down your system, it’s time to learn how you can do that in Ubuntu  20.04 using a terminal. The shutdown command can be used in several ways; for example, if someone wants to shut down the system instantly, then they can follow the below-mentioned syntax:

$ sudo shutdown [options] [Time] [Message] 

There are various options available for shutting down the system, as you can also halt or reboot your system rather than just shutting it down, so you need to mention it in the [options] field. If you like to shut down your computer in advance with a predefined time slot, you should mention it in the [Time] field. If you want to display any message about why you are shutting down the system or anything else, you should mention it in the [Message] field.

You can write the time at which you want to shut down the window

$ shutdown now

This will turn off your system without any delay.

Now suppose if you are installing updates or any software that takes some time for the installation, and suddenly there is an urgent work that needed to be done as soon as possible, then you can also shut down the system even after some delay that you like

For example, you want to Shutdown the system after 30 minutes; you can write

$ Shutdown -h 30

This will Shutdown your system after 30 minutes, and it will also show you the exact time when the system will turn off by adding 30 minutes.

Also, to shutdown your PC after two hours use the command mentioned below:

$ Shutdown -h 120

Here 120 represents the total number of minutes that are in two hours. So as the time is shown in the picture above, it will be 120 minutes, and then it will show you the Time to Shutdown.

Now you have the basic idea of how you can shut down the system after any delay. How can you shut down the system after a specific clock time? For this, write the below given command:

$ shutdown -h 07:30

If you are curious about what you can do other than just shutting down the system, then you can get the basic information using the following command

$ Shutdown --help

How to shut down the system with a custom message

If you are the administrator or handling multiple systems and would like to Shutdown all the systems together due to some important update. Then it is recommended to send a custom message with a specific delay to everyone so that they don’t have to face any data loss issue as they might be working on an important task and can wrap up their work.  So the shutdown command with a message is given below:

$ shutdown 15 "The system will shut down after 15 minutes for an important update."

If you have scheduled your computer for Shutdown after a certain time delay and later want to cancel it, you can do that by the following command as shown below.

$ sudo shutdown -c

Conclusion

The most essential reason to shut down your computer is to resolve system faults, which will extend the life of your system components by reducing heating concerns. By rarely shutting down your computer, you are placing it at greater risk of harm. This write-up has demonstrated how to turn-off your PC after a specified time. Other than that, you have also learned to timely shut down your computer by setting the desired time. This feature can help you install any necessary time-consuming update or any software application, and you don’t have time to shut it down later manually.