How to use an external monitor with the terminal

The command to control the monitor is xrandr. To have information on the monitor in use type:

xrandr -q

To turn off the monitor of the laptop (LVDS1) when there's a connection with an external monitor (VGA1) type as follow:

xrandr --output LVDS1 --off

To turn it on again type:

xrandr --output LVDS1 --auto

To use the external monitor like an extension of the monitor of the laptop on its right side:

xrandr --output VGA1 --auto --right-of LVDS1 --mode 1024x768

To know if the monitor is connected:

xrandr | grep VGA1 | grep +

Or you can use the command

xrandr --screen 0