Turn off monitor using command line
The xset
command mentioned in other answers will turn off all the monitors if you have multiple monitor setup. However if you want turn off only one or some of the monitor you should use xrandr
.
First run xrandr -q
command, which will list all the monitors and its current display settings. At the start of each monitor details you will find monitor name set by the system. You have to keep track of that.
I have two monitors (one is connected to DVI port and other to VGA port) and when I run the command I see this:
Screen 0: minimum 320 x 200, current 1360 x 768, maximum 2726 x 2726
DFP1 connected 1360x768+0+0 (normal left inverted right x axis y axis) 304mm x 228mm
1360x768 59.7*+
... (more details are shown here, but I have hidden it)
CRT1 connected 1360x768+0+0 (normal left inverted right x axis y axis) 410mm x 230mm
1360x768 59.8*+ 60.0
... (more details are shown here, but I have hidden it)
In this output, DVI port connected monitor is labelled as DFP1
and other one as CRT1
. So if I want turn off the secondary monitor(i.e., CRT1
) I have run this command:
xrandr --output CRT1 --off
if you want switch on that monitor again then you have run this command:
xrandr --output CRT1 --auto