17.2 C
Texas
angeloma
Senior Writer and partner

How to Shutdown Linux using the terminal?

Hello, friends. In this post, we address a simple topic that although we always do it using a graphical interface, sometimes it is useful to do it from a terminal. So after reading this post, you will learn how to shutdown Linux from the terminal.

Shutting down and restarting a computer is a simple and routine task that is also important for the operating system. That is why we all do it.

Things can get complicated when we need to do it using the terminal because it is not a normal process. This may be needed when creating bash scripts or if some of our applications require it.

So for this, we have several commands and situations. Let’s go for it.

How to Shutdown Linux

- Advertisement -

To shutdown the computer immediately, you just have to run the following command

shutdown -h now

Note: this command has to be executed with root permissions or using the sudo command.

This way, the system will immediately start the shutdown process.

Another way to do this is with the poweroff command.

poweroff

Also, this command requires root privileges.

shutdown Linux after a specified time

Imagine you are downloading a file and you know approximately how much time is left. But you have to leave or do other things, you can “schedule” a system shutdown.

To do this, you can use the following syntax.

shutdown -h +[time]

For example, if you want the system to shut down in 20 minutes, just run:

shutdown -h +20

Also, you have to run the command with sudo or be root user.

Shutdown Linux at a specific time

On the other hand, if you know at what time you want to shut down the system, then you can also do it this way:

shutdown -h [time]

Replace [time] with the exact time in 24H format. For example, if we want the system to shut down at 20:30 hrs.

shutdown -h 20:30

Reboot Linux

The command to reboot the system is shutdown but adding the -r option

shutdown -r now

Or you can schedule it for a specific time:

shutdown -r 20:30

In the same way as with shutting down the system

Conclusion

It is always useful to know how to use the terminal and the utilities that we can take advantage of it. That’s why in this post, you learned how to do it hoping that it can always be useful to you.

More info: Shutdown page

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article