How to shutdown Ubuntu via the terminal

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn how to shutdow Ubuntu via the terminal.

If you've been using GUI to shut down your Ubuntu machine, and wondering if you can do the same thing via the terminal, the answer is yes, you can shutdown your Ubuntu machine easily via the terminal.

Shutting down Ubuntu via terminal is done easily by using the shutdown command.

What is Shutdown command

Shutdown command allows you to shutdown your Ubuntu machine directly from the terminal.

In this tutorial, we'll be using the shutdown command, to shut down our Ubuntu machine using different shutdown scenarios.

shutdown

Shutdown Ubuntu using default command

Let's say that you want to shut down your Ubuntu system, but you don't want to set any time or schedule it.

Then to do so, you need to use the command below.

sudo shutdown

💡
When you run only the shutdown command, without passing any argument, then your system will be scheduled to shut down automatically after one minute.

Shut down Ubuntu immediately

To shut down your Ubuntu system, without having to wait after running the shutdown command, you can do so by using the now option.

To shutdown Ubuntu immediately after executing the shutdown command, simply run the command below.

sudo shutdown now

Schedule an automatic shutdown

Schedule option allows you to schedule the time when you want to shutdown your Ubuntu system.

All you need to do is set the time when you want your Ubuntu system to shutdown.

For example, to shutdown Ubuntu after 40 minutes, you need to set the time to +40 after the shutdown command.

sudo shutdown +40

Shutdown Ubuntu at a specific Time

Let's say you want to shut down your Ubuntu system at 5pm in the afternoon. To do so , you need to set the exact time 5:00 after the shutdown command.

For example, the command below, will shut down your Ubuntu system at 5pm in the afternoon.

sudo shutdown 5:00

Cancel a scheduled shutdown

If you have scheduled a shut down in your system, and you want to cancel it. You need to use the -c option.

-c allows you to cancel any pending shut down operation.

shutdown -c

Conclusion

In this tutorial, you learned how to shutdown Ubuntu via the terminal by using the shutdown command.

Whether you shut down your Ubuntu machine using GUI or terminal, make sure you do it the right way, by closing all apps that you are using first.