Set Alarm to Automatically Power On Linux Computer

It’s no secret that you can make your computer “sleep” to considerably save energy or battery on laptops. A battery-powered device can spend many days in standby mode. The power draw in this state is incredibly low.

You can wake your computer at any time by pressing the power button or a key on your keyboard. But what if you want it to automatically wake up at a certain time? This can help you automate certain tasks – for example, to download something at 4AM when Internet speed may be much higher. With a bit of command-line magic, you can schedule your device to wake up, take some action and then go back to sleep again.

Besides waking up from standby, you may find it even more useful to completely shut down your computer and power on at certain times. Hibernation is also supported, but Linux systems that use proprietary drivers don’t always wake from hibernation properly.

Test If Your Computer Supports Wake-Up Timers

It’s possible that some computers don’t have the proper hardware to support this feature. However, on most configurations, this should work. You can do a quick test: open a terminal emulator and enter the following command.

sudo rtcwake -m mem -s 30

Your computer should go to sleep and wake up thirty seconds later. If your device needs more than twenty seconds for standby, increase the wake-up time by changing “30” to a higher number.

Also, test if the computer supports waking up from a complete shutdown.

sudo rtcwake -m off -s 60

Regarding -m off, the command manual mentions: “Not officially supported by ACPI, but it usually works.”

If the kernel, drivers and hardware all get along with each other, you should have no problems. If the timers aren’t supported, it’s probably because the hardware and/or BIOS/UEFI configurations don’t meet the requirements. But you might as well try your luck and see if upgrading some drivers or switching from proprietary ones to open source does the trick. You can also try to install a newer kernel.

As previously mentioned, hibernation has issues non-related to the rtcwake command. It does work most of the time but also fails on occasion. When it fails, your screen will remain black or show you an error message.

How to Use the rtcwake Command

The basic use of the command is simple: pick a power-saving method and a time when to wake up. In the previous command the -s parameter was used to specify how many seconds to wait before powering back on. But usually you will want to specify an absolute time, like 9AM tomorrow morning. For that, you use the --date parameter instead of -s.

rtcwake Date Parameter

sudo rtcwake -m mem --date 09:00

Note: not all hardware supports setting wake up dates far into the future. This is something that you’ll just have to test to see if it works for your specific device.

Time specification is in 24-hour format. Here’s a relevant screenshot of the command manual with different options for setting the time and date of a wake-up event.


“YYYY-MM-DD hh:mm” means, year, month, day, hour and minute – for example: --date 2020-02-28 15:00 for the 28th of February, year 2020, 3PM.

rtcwake Dry Run

You can add another parameter to rtcwake, -n, to display when the alarm will be set.

sudo rtcwake -m mem --date +12hours -n

This is a “dry run,” meaning it doesn’t actually set an alarm and only “pretends” to do it. It’s useful to add -n when you want to test if your date specification is correct. Once you’re sure it’s right, just use the command without -n to set the actual wake-up time.

rtcwake Power-Saving Methods

The relevant options you can pass to the -m parameter are:

  • -m mem – normal standby mode you’re familiar with from the shutdown menu.
  • -m disk – hibernate mode that saves memory content to storage device. Not recommended when using proprietary drivers.
  • -m off – normal shutdown.
  • -m disable – cancel a wake-up event you previously set.
  • -m no – don’t power off or standby, just set a wake event. For example, you can set a wake-up time for tomorrow morning, then continue to work on your computer. When you’re done, shut down normally, and the device will automatically power on in the morning.
  • -m show – show wake-up events (previously-set alarms) currently active.


It’s up to you to find creative ways to use rtcwake. As a starter, this can help you find the computer fully booted in the morning. This way you skip the boring boot process which can take more than a minute on some systems. You could also install an utility, such as at, to automate tasks that your computer can run after waking up. We might even explore that option in a future tutorial.

Alexandru Andrei

Fell in love with computers when he was four years old. 27 years later, the passion is still burning, fueling constant learning. Spends most of his time in terminal windows and SSH sessions, managing Linux desktops and servers.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox