Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a laptop that is hooked up to a monitor via a VGA cable. I'm trying to get the display set to the external monitor only (I don't want any display on the laptop screen). However, whenever I set the laptop display to "off" in the "Displays" setting, their isn't a display on either (the laptop screen and the monitor have no signal). So, how do I get it to where the display only shows up on the external monitor?

share|improve this question
up vote 3 down vote accepted

You can use xrandr to change the default primary monitor.

Turns out xrandr --output DFP1 --primary does the trick. Replace DFP1 to the name of the monitor you want to make your primary monitor. You can run xrandr --prop to get the proper names of the monitors currently connected.

If you run xrandr --output DFP1 --primary, it does switch the primary monitors, but once you restart your laptop, the laptop becomes the primary display once again.

So, I thought I would write a simple script, that runs at start up, which checks, if there is an external monitor connected, and if there is, then run the command to make the external monitor the primary display.

NR_OF_MONITORS=$(xrandr -d :0 -q | grep ' connected' | wc -l)
if [ $NR_OF_MONITORS = "2" ]; then
  xrandr --output DFP1 --primary


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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