How to make Linux PC wake from sleep automatically [Tip]

If you want to put your Linux computer to sleep or be in hibernation mode and automatically have it back up and working at a specific time. It is more than simple and easy and you can easily achieve that by using a simple command called rtcwake which is encompassed by default with the Linux OSes.This feature can be valuable if you want the computer to do some specific work at some specific time but you do not want it running seamless without any purpose. Here are the steps to achieve that:sleep-wake-rtcwake-worked

Using rtcwake

On Ubuntu type following command in terminal to activate rtcwake.

    sudo rtcwake -m [type of suspend] -s [number of seconds]

After activating it type below command which basically suspends your system and wakes it back up 60 seconds later:

    sudo rtcwake -m disk -s 60

Types of Suspend

The -m switch which we have used in earlier commands offers following types of suspend

  • Standby – it offers short saving of power but coming back to a running system is very quick.
  • mem –This command offer us substantial power savings. Everything is placed into a lower power state.
  • Disk –in this basically subjects of your memory are being saved to disk and your computer is switched off. When computer is turned on then its state will be returned after the completion of timer.
  • off –this simply turn the computer off completely.
  • no – it Do not suspends the computer instantly Seconds vs. Specific Time

You can also use the option –t which basically allows the computer to wake up at certain time. This -t switch just wants the number of seconds.

While the -l switch conveys the rtcwake that the HW clock is fixed to local time, whereas the -u switch expresses rtcwake the hardware clock that is in your computer’s BIOS is established to UTC time. Linux providers frequently establish the hardware clock to UTC time and interpret it to the local time.

Tips & Tricks

You can use && operator to run an explicit commands after rtcwake wakes your computer from the sleep. Let’s consider an example for simplification, following command will suspends computer to RAM and wakes it after two minutes and then it will launch the Firefox:

                         rtcwake -m mem -s 120 && Firefox


Following are few cases if you fall under one of these the above methods, unfortunately, may not work for you.

  • The words RTC is short form used for real time clock. In simple words rtcwake uses the computer’s hardware clock. Which is added in you machine’s BIOS. To determine when your computer will wake up. If using some old computer with a dead CMOS that cannot keep the clock running accurately, this will not work.time
  • If suspend to RAM, sleep, or hibernate do not work properly with the Linux system possibly because Linux does not have drivers to make them work correctly with the hardware this will not work again.

So guys these are the methods you can employ for making your Linux sleep and wake automatically. Follow them step by step to get effective results.

Related Posts