Turn Primary Display On/Off using xrandr

Run the xrandr command to identify your primary display:

% xrandr
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192
eDP1 connected (normal left inverted right x axis y axis)
   1920x1080     60.02 +
   1400x1050     59.98  
   1280x1024     60.02  
   1280x960      60.00  
   1024x768      60.00  
   800x600       60.32    56.25  
   640x480       59.94  
DP1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
DP2 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 518mm x 324mm
   1920x1200     59.95 +
   1920x1080     59.93* 
   1600x1200     60.00  
   1680x1050     59.95  
   1280x1024     75.02    60.02  
   1440x900      59.89  
   1280x800      59.81  
   1024x768      75.03    70.07    60.00  
   800x600       72.19    75.00    60.32  
   640x480       75.00    72.81    66.67    59.94  
   720x400       70.08  
HDMI2 disconnected (normal left inverted right x axis y axis)

In this example, eDP1 is the primary laptop display. To turn it off via the command line, run:

% xrandr --output eDP1 --off

To turn it back on again, run:

% xrandr --output eDP1 --auto
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License