NVidia video card with NVidia drivers. Debian 8. Multiple monitors

I currently have 2 screens connected to my computer. Usually (while working) I like to use both. Sometimes (while gaming) I only want one to be active.

Actually there is a third usecase (watching movie on a projector, while screen 1 and 2 are off) but let's ignore that for now.

What I am looking for is a simple way (cli command, script that can be tied to e.g a hotkey, etc) to change the X server configuration. I can use nvidia-settings to change the configuration, but that is a clicky interface and I am looking for the one-button solution.

Does not matter if the configuration sticks across reboots (preferred would be only temporary change)


The tool you are looking for is 'xrandr'. Running xrandr without parameters gives you the list of known outputs, attached devices, available resolutions (including preferred ones and used ones).

For example, to deactivate an output, run

xrandr --output NAME-OF-OUTPUT --off

To set an output to on and its preferred resolution, run

xrandr --output NAME-OF-OUTPUT --auto

Or to a specific, supported resolution

xrandr --output NAME-OF-OUTPUT --mode 1024x768

There are many more options, just look into the man pages. Collect your xrandr commands in shell scripts and configure your system to execute those scripts upon hotkey press.

  • xrandr --output VGA-0 --auto --rotate inverted --below DVI-D-0 was exactly what I was looking for – Canine Sand Dec 23 '14 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.