Create a Virtual Monitor Power Button

A friend had an interesting problem for me to solve; he wanted to know how to turn off his laptop’s monitor without shutting down the system or waiting for it to go off. He wanted to leave it working during the night on the desk in his room, without the light from the LCD bothering him while he slept.

Luckily there is a Linux command to do just about anything. To turn off your monitor from a terminal, run this command:

sleep 1 && xset dpms force off

Moving the mouse or pressing a key will turn the monitor back on.

The sleep 1 (wait for one second) is needed only when you are typing the command in a terminal. This is because the command is executed as soon as the enter key is pressed, when it lifts up X turns the monitor back on.

The xset command is used for setting X display preferences. In this case it uses VESA Display Power Management Signaling to turn off the monitor.

You can create a desktop or panel launcher to do the same thing.

Turn off your monitor

Right click on the desktop and select Create Launcher. Use the command xset dpms force off, give it a name, and choose a nice icon. You can also drag it on to your panel for convenient access.

[update] An anonymous commenter asks: Is there anyway to lock the screen and power down the monitor in one launcher?

Use this command to run the screensaver (which will lock), wait, and then turn off the monitor:

gnome-screensaver-command --lock && sleep 2 && xset dpms force off

Archived Comments

Andrew Conkling

You can also use Brightside bound to a screen corner or edge if you prefer.


Awesome tip. I have a problem though :(

It works great from the terminal but when I create a custom launcher and execute it, the screen simply turns off then turns back on. Pretty similar to what happens in the terminal if you leave out the sleep command.

Any ideas?


Hmm, I should have added what I run - that might help huh !

Ubuntu 7.10
nvidia 8800 GTS w/ 169.04 nvidia drivers
desktop effects enabled

If you need any others, let me know.


the only thing I can think of would be to try creating a launcher with a longer sleep time.


It works great!!

Silly me, I believe it was just me slightly moving the mouse after letting go of the button. Put it towards a case of PEBKAC I think :)


Thanks you so much!

Kevinator bob!

Thanks for the tip! I am going to use this all the time instead of reaching all the way over to push that button.
thanks for the info


Is there anyway to lock the screen and power down the monitor in one launcher?


Hey, not sure why the application launcher method isn’t working for me.

I double clicked it and nothing happens.

But the command works in terminal.

I’m running ubuntu 8.10. any suggestions?



Thanks, that’s exactly what I wanted to do as well: sleep while the computer is on.


To lock the screen and blank the monitor press the Crtl+Alt+L combination


This is sweet, thanks

I’ve been looking for a way to turn my monitor off after i’m done watching tv shows without having to get out of bed


um close the lid? just make sure it doesnt hibernate or shut down etc

sports picks

How can you not love Linux? Great post.


Really interesting problem… Hows about just closing the lid…

jonny rocket

this will come in handy some day.


Why not just turn the monitor off?


Why not just turn the monitor off?

Turn off laptop monitor if you can :P

Scott Maddox

I’d like to point out that by switching ‘off’ to ‘on’ you can wake up the monitor. I’m using these for turning the screen off when I’m going to sleep, then I have my alarm script turn the screen back on and open up firefox to my morning lineup. Saves me a good minute every morning.


The next command placed in /etc/crontab will turn on the monitor at desired time:
/usr/bin/xset dpms force on


This worked perfectly! Thank you so very much!
Just a question tough, Does it switch off the backlight too? Sorry if it’s a silly question but I read that the backlight doesn’t turn off easily or something like that.


The backlight should switch off.


This does not work anymore on ubuntu 10.04? Any idea


It’s still working on all my systems.


How can you not love Linux? Great post.


can you not love Linux?
thank you very much indeed for that ;)

Respond via email