How to Schedule a Shutdown in Ubuntu

  • Post category:Ubuntu

Sometimes, you may want to schedule your system to shut down automatically after a specific duration or at a set time. Ubuntu makes this simple with the shutdown command, which allows you to manage shutdowns both by time and after a delay.

In this post, we’ll walk through how to schedule a shutdown in Ubuntu using the terminal, along with steps to cancel a scheduled shutdown if you change your mind.

1. Scheduling a Shutdown at a Specific Time

If you want to shut down your Ubuntu system at a specific time, follow these steps:

Steps:

  1. Open the Terminal:
  • Press Ctrl + Alt + T to open a new terminal window.
  1. Enter the Shutdown Command:
  • Use the following syntax to schedule a shutdown at a specific time:
    bash sudo shutdown HH:MM
    Replace HH:MM with the desired shutdown time in 24-hour format.

Example:

  • To schedule a shutdown at 8:30 PM, type:
  sudo shutdown 20:30

Your system will automatically shut down at the time you’ve set.

2. Scheduling a Shutdown After a Delay

If you’d like to shut down your system after a specific duration (in minutes), you can easily do this by using a relative time.

Steps:

  1. Open the Terminal.
  2. Enter the Shutdown Command:
  • To schedule a shutdown after a set number of minutes, use the following syntax:
    bash sudo shutdown +N
    Replace N with the number of minutes you want to wait before shutting down.

Example:

  • To schedule a shutdown after 15 minutes, type:
  sudo shutdown +15

This tells Ubuntu to automatically power off the system 15 minutes after you execute the command.

3. Canceling a Scheduled Shutdown

If you change your mind and need to cancel a scheduled shutdown, you can do that with a simple command.

Steps:

  1. Open the Terminal.
  2. Enter the Cancel Command:
  • To cancel the scheduled shutdown, type:
    bash sudo shutdown -c

This command will cancel any shutdown that is currently scheduled, allowing your system to continue running as normal.

Final Notes

  • Remember that the shutdown command requires superuser privileges, which is why sudo is needed.
  • If you don’t specify a time or use now in the shutdown command, Ubuntu will default to shutting down after one minute.

With these simple commands, you can control when your system powers off—whether it’s at a precise time or after a delay. It’s a great way to automate your system’s power management.

For more tutorials and tips, explore other posts on codeallow.com.