Raspberry Pi: Disable screensaver / blank screen

Raspberry Pi Logo
Print Friendly, PDF & Email

If you want to run a slide show or something similar on your Pi, you don’t want to constantly go into ‘screensaver mode’ or ‘energy star’ mode.

This guide is based on Raspbian, fully updated as at 4 Aug 2014.

If your Pi runs X by default, you can disable the screensaver or power saving mode as follows:

# Edit the /etc/X11/xinit/xinitrc file and add the following three lines at the bottom of the file
xset s off         # don't activate screensaver
xset -dpms         # disable DPMS (Energy Star) features.
xset s noblank     # don't blank the video device

If you run the console by default, but still want to prevent the screen from going blank, you can do it with the following single command:

sudo sh -c "TERM=linux setterm -blank 0 >/dev/tty0"

Share and Enjoy !

0 0

Add a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.


  1. Neil Perlin

    I’m trying to follow the steps by modifying the xinitrc file using Leafpad. However, when I try to save my changes to xinitrc, I get a message that the xinitrc file already exists and asking if I want to overwrite it. When I click Yes, I get a second message stating that Leafpad “Can’t open file to write”. Any idea what I’m doing wrong?


    1. LeafPad probably does not run with the right permissions.
      Try the following:
      Open LXTerminal (or similar)

      pi@myownpi ~ $ sudo leafpad

      And try to open and edit the file again.

      Alternatively, if you are familiar with command line editors, you can use either nano or vi

      pi@myownpi ~ $ sudo vi /etc/X11/xinit/xinitrc
      # or
      pi@myownpi ~ $ sudo nano /etc/X11/xinit/xinitrc

  2. Neil Perlin

    To hschoeman,
    Thanks for the tips but I still seem to be doing something wrong. Here’s what I did:
    – Used your sample command to start Nano, then entered the three lines, saved, and exited Nano.
    – Shut down Linux using “sudo shutdown – h now”
    – Shut down the Pi by pulling the plug.
    – Plugged the Pi back in.
    – Logged in, went to the GUI, launched LibreOffice Impress, and started my presentation in Slide Show mode. It still timed out and went to the blank screen after 10 minutes.
    – I re-opened /etc/X11/xinit/xinitrc in Nano to see if the three xset lines that I’d added were still there. They were.
    If you have any idea what’s going on, I’d very much appreciate it. I want to set up a kiosk to run unattended and I obviously need the presentation to run without the screen blanking. And I need it running in two weeks…

  3. xpeace


    The above had no effect on my Raspbian unit.
    However when adding these changes to the windowmanager config file it worked.

  4. David Fraser

    I’d been searching for an answer for days… this works on the terminal level 100% needed it for a kivy app I was running. The code on this site is missing the trailing ” if you paste it into the terminal so add it.

    sudo sh -c “TERM=linux setterm -blank 0 >/dev/tty0”

    1. Tx David, I fixed the post to reflect the issue you found. Apologies if I sent some people on a wild witch hunt for no reason as a result 😛