The screen rotation function in Nvidia graphics driver is normally disabled. But We can enable it by modifying xorg.conf file.
To do this, we need to back up xorg.conf file first.
$ sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
Now edit the file:
$ sudo gedit /etc/X11/xorg.conf
In the Device section that includes the line:
Driver "nvidia"
Add:
Option "RandRRotation" "on"
It will looks like:
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
Option "RandRRotation" "on"
EndSection
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
Option "RandRRotation" "on"
EndSection
Then, we need to log out and log back in to restart X server.
To rotate screen to left, use:
$ xrandr -o left
To rotate screen to right, use:
$ xrandr -o right
To flip screen upside down, use:
$ xrandr -o inverted
To go back to normal, use:
$ xrandr -o normal