How to schedule shutdown on Ubuntu 22.04 or Linux, this is a useful feature that allows you to automatically shutdown your computer after a certain period of time. This is useful when you want to perform tasks automatically or save energy. In this article, we will learn how to schedule shutdown on Linux Ubuntu operating system in detail.
How to Schedule Shutdown on Ubuntu or Linux
On Linux Ubuntu, you can use a command
shutdown to schedule a shutdown. This command allows you to perform a variety of tasks, including a shutdown timer.
Here is the command syntax
shutdown [option] [time] [message]
option: An option of a command, such as
-cto cancel the timer job.
time: Timer duration, which can be a specific time (eg )
21:30or after a certain amount of time (eg
+60for after 60 minutes).
message: The message displayed before the shutdown timer.
Here are some examples of how to use the command
shutdown to schedule shutdown on Ubuntu 22.04:
Note: You need to use administrative privileges ( sudo ) to run the command
shutdown, because only users with administrative privileges can perform shutdown tasks.
- Timer to shutdown after 30 minutes:
sudo shutdown -h +30 "Timer to shutdown after 30 minutes"
- Timed shutdown at 21:30:
sudo shutdown -h 21:30 "Time to shutdown at 21:30"
- Cancel the timer task:
sudo shutdown -c
When you run the above command, the shutdown timer job will be canceled and the computer will not shut down at the scheduled time.