Raspberry Pi: Wake from Sleep – Command

While using a Raspberry Pi (RPi) connected to a monitor or TV over HDMI, you may notice that the screen will be automatically put to sleep after a certain amount of time of inactivity.

To wake the RPi it is usually enough just to move a mouse or press some key button.

But if you are connected remotely over SSH, it seem that the only thing that you can do to wake the RPi from sleep is to reboot it.

Lucky there is a way to wake the RPi and unblank the screen from a terminal by changing display power management and screen saver settings.

Cool Tip: HDMI hotplug settings on a Raspberry Pi! Read more →

Wake RPi from Sleep

😴 Wake RPi from Sleep: Actually, there’s no wake/sleep functionality in RPi, but it can blank the video device connected to the screen. When the display stops receiving a video signal, it usually goes into a sleep mode.

If you have connected to your PRi over SSH, first of all you should specify on which display you want to unblank the screen:

$ export DISPLAY=:0

To identify the display number, execute:

$ w
- sample output -
 13:47:34 up 7 min,  3 users,  load average: 0.17, 0.38, 0.26
pi      tty1    -               13:39   8:03  0.15s 0.11s -bash
pi      tty7    :0 ←            13:39   8:02  1.87s 0.18s /usr/bin/lxsession -s LXDE-pi -e LXDE
pi      pts/0    13:40   2.00s 0.15s 0.03s w

To wake the monitor connected to your Raspberry Pi, try the commands below.

  • Disable/enable display power management signaling (DPMS) features:
    $ xset -dpms && xset +dpms
  • Turn the screen saver off and on:
    $ xset s off && xset s on
  • Turn the screen blanking off and on:
    $ xset s noblank && xset s blank

Cool Tip: Shutdown & reboot a Raspberry Pi safely! Read more →

You can determine the power state of the connected monitor, the values of the DPMS and screen saver parameters by using the command below:

$ xset q
- sample output -
Keyboard Control:
  auto repeat:  on    key click percent:  0    LED mask:  00000000
  XKB indicators:
    00: Caps Lock:   off    01: Num Lock:    off    02: Scroll Lock: off
    03: Compose:     off    04: Kana:        off    05: Sleep:       off
    06: Suspend:     off    07: Mute:        off    08: Misc:        off
    09: Mail:        off    10: Charging:    off    11: Shift Lock:  off
    12: Group 2:     off    13: Mouse Keys:  off
  auto repeat delay:  500    repeat rate:  30
  auto repeating keys:  00ffffffdffffbbf
  bell percent:  50    bell pitch:  400    bell duration:  100
Pointer Control:
  acceleration:  20/10    threshold:  10
Screen Saver:
  prefer blanking:  yes    allow exposures:  yes
  timeout:  600    cycle:  600
  default colormap:  0x20    BlackPixel:  0x0    WhitePixel:  0xffffff
Font Path:
DPMS (Energy Star):
  Standby: 600    Suspend: 600    Off: 600
  DPMS is Enabled
  Monitor is On

To permanently disable/enable the screen saver – use the Raspberry Pi configuration tool:

$ raspi-config

Select the “Advanced Options” and then the “Screen Blanking”:

Was it useful? Share this post with the world!

Leave a Reply