How to Turn Off Monitor Using Command-line in Ubuntu 20.04

Turn Off Monitor

If you do not need to stare at your computer terminal and want to turn off the monitor to save energy or whatever reason then there are a couple of commands at your disposal.

vbetool Utility

You can use the vbetool utility to turn off the display as follows. First, install the utility using apt.

$ sudo apt-get install vbetool

Run the following command to turn off the display.

$ sudo vbetool dpms off

To regain control of the console by pressing Enter key, use the following command:

$ sudo sh -c 'vbetool dpms off; read ans; vbetool dpms on'

Using xset

You can use xset to turn of the display using:

$ xset -display :0.0 dpms force off

or turn on the display using:

$ xset -display :0.0 dpms force on

You can set a delay before the monitor goes off to allow all events to be processed by the X server before turning the display off using the following:

$ sleep 1 && xset -display :0.0 dpms force off

Using xrandr to Turn off Single Monitor

You can use xrandr to turn off a specific monitor seeing the other methods here act on all monitors. Run the following command to list your monitors:

Read Also  Qt 5.7 Release now Available for Immediate Use

$ xrandr -q

Assuming your monitor is identified as CRT1 then you would run the following to turn it off.

$ xrandr --output CRT1 --off

Or the following to turn it on:

$ xrandr --output CRT1 --auto