There are times when I want to turn off the displays on my workstation, but not actually lock it. In this Linux quicktip we will show you how to turn your displays off using the command line. We will also show you how to use that command as a keyboard shortcut, or HotKey.
Turn Display Off From the Linux Command Line
To turn your display(s) off from the command line we will use the xset
utility.
xset dpms force off
The xset
utility allows you to change user preference options for the display. The dpms
part is specific Energy Star parameters or options. We use force off
to tell the system to instantly switch dpms
to the off
state.
Set Keyboard Shortcut to Turn Off Display
In Gnome you can easily create a shortcut to trigger this command.
First, go into setting by selecting the top right tray.
From the settings menu, select "Keyboard Shortcuts".
Now scroll all the way to the bottom of the list. There you will find a plus sign at the bottom of the list that allows you to add your own custom shortcuts.
When you click the plus sign you will be shown the "Add Custom Shortcut" window which requires some input. First, let's name it something relevant. For this example I named the shortcut "Display Off".
In the command section we will call the xset
utiltiy, just as we did on the command line above.
Last, we need to set the shortcut. Just click it and then enter the key, or keys you want to use. For this example I chose Super+D, which is purposely close to Super+L, which I use all the time.
That's it, click the Add button and you are all set.
Conclusion
Now you can easily turn off your monitors from the Linux command line, or the Gnome Keyboard Shortcuts. We hope you found this quick tip helpful