Turn off monitor from Linux CLI

March 21, 2012 by Noah
I keep looking up this information and then losing track of it, so I'm posting it here for my own reference.

This command will turn off the monitor on a Linux box from the command line (sorta like what happens when you have your power saving options configured to do this automatically after a length of time):

xset dpms force off
The monitor turns off until you hit a keyboard button or move the mouse. With this info you could set up a keyboard shortcut to run this command and have something like a "lock screen button" on your netbook, to turn off the display on command and conserve battery life for a little bit longer than usual.

For a "lock screen button" that also locks the screen in addition to turning it off, a pair of commands like this may be handy:

xset dpms force off; xscreensaver-command --lock


There are 17 comments on this page. Add yours.

Avatar image
blueskull posted on July 27, 2012 @ 03:43 UTC

Thank you!

Avatar image
mertin posted on March 26, 2013 @ 15:39 UTC

I always forget how to do this and your page is the first one that comes up in the google search. Thanks for the simple handy tip

Avatar image
me posted on March 29, 2013 @ 03:01 UTC


Avatar image
Coder@linux posted on May 28, 2013 @ 12:57 UTC

Hi I am trying to turn off 4 monitors at a time using the above command. It so happens that it turns off the 3 monitors except for 1 which displays RGB screensaver . Can you suggest a way out to turn off all the 4 monitors .

Avatar image
easoncxz posted on July 30, 2013 @ 21:40 UTC

Simple works. Thanks for sharing!

Avatar image
Anonymous posted on October 2, 2013 @ 15:18 UTC


Avatar image
A.Nony.Mouse posted on March 9, 2014 @ 19:35 UTC

Thanks, needed a way to do this from an "at" job in the middle of the night.

Avatar image
Javier Acosta posted on October 28, 2014 @ 06:33 UTC

thank you very much!

Avatar image
Pooping posted on January 29, 2015 @ 16:31 UTC

in the Shower tf2 get good get lmaobox poop.

Avatar image
Bocskai Csaba posted on June 8, 2015 @ 11:11 UTC

Thanks a lot! I wonder if it's simple to create a button for this...

Avatar image
Habib posted on June 10, 2015 @ 05:56 UTC

Thanks! This was a big help...

Avatar image
Subin posted on August 25, 2015 @ 16:19 UTC

Thanks a ton !! Very Helpful. You could write a shell script as follows and run it from the Desktop like a batch file in windows

Create a new file with text editor

xset dpms force off

Save file as .sh extension Chmod 755 to set permissions

Avatar image
7Blink posted on August 18, 2016 @ 20:53 UTC

Thank you. I created a Desktop Icon with that command to put my monitor to sleep.

Avatar image
tuxman posted on July 9, 2019 @ 03:53 UTC

Thank you! This is exactly what I was looking for. Useful short guide.

Avatar image
tuxman posted on July 9, 2019 @ 18:23 UTC

Forgot to mention for a more lightweight alternative there is i3lock. So for a black screen use xset dpms force off; i3lock -c 000000 -n

or with a background picture xset dpms force off; i3lock -i /path/to/picture/only.png -n

Avatar image
01101001b posted on August 22, 2020 @ 02:39 UTC

This is EXACTLY what I needed! And it worked beautifully! Thank you so much! =)

Avatar image
mule.ear posted on March 8, 2021 @ 15:58 UTC

I needed to be able to do this remotely, and just needed to add 'display :0' to the command. So now I can ssh in and run xset -display :0 dpms force off or just ssh targetMachine "xset -display :0 dpms force off"

Nine years after your original post and it's still helping people.

Add a Comment

Used for your Gravatar and optional thread subscription. Privacy policy.
You may format your message using GitHub Flavored Markdown syntax.