Change screen resolution to something working from the command line

Sometimes I setup a single external monitor output on my laptop. When I take the laptop home I disconnect the monitor and forget then how to turn back the laptop monitor.

This is how I solve it. First i go to a virtual console outside X by pressing Control + Alt + F1. Then enter my crendentials and run:

### Change the laptop screen to something usefull
sudo bash -c 'chvt 7; xrandr --display :0.0 --auto`

Where chvt changes back to the X virtual terminal, and xrandr --display :0.0 --auto brings back my laptop monitor.

If you liked this post, you can share it with your followers or follow me on Twitter!