Home Linux Hardware
Only tested this with the nvidia driver.

vi /etc/X11/xorg.conf

add the following line in the device section:

Option "RandRRotation" "on"

add the following line to the ServerLayout section:

Option "RandR" "true"



The following command rotates the screen to the left:

xrandr -o left


The following command rotates the sceen back to normal:

xrandr -o normal


Here is a little script I wrote that will rotate the screen automaticaly to the oposite of its current position:

#!/bin/bash

if xrandr | grep "Current rotation - normal"
then 
  xrandr -o left 
else 
  xrandr -o normal 
fi