How to rotate screen in Ubuntu using terminal?

You should use xrandr command. xrandr -o normal takes your screen back to normal (landscape) rotation.

You can check this command typing xrandr -o left and then get back to normal.


You can use these commands:

xrandr --output $(xrandr |grep eDP|cut -d" " -f1) --rotate left
xrandr --output $(xrandr |grep eDP|cut -d" " -f1) --rotate normal

also right and inverted

I created a script here: https://gist.github.com/rubo77/d43cc5b3ff65d6df28b8b8c3c089f23b

with that script, you can simply call

rotatescreen.sh -r
rotatescreen.sh -l
rotatescreen.sh -i
rotatescreen.sh -n

Alternative, you can use CTRL+F8 to rotate using

gsettings set org.gnome.mutter.keybindings rotate-monitor "['XF86RotateWindows', '<Control>F8']"

see https://askubuntu.com/a/1184316/34298