38

Recently I booted Ubuntu 18.04 Live USB and I faced annoying problem. Screen was rotated and there was no rotate options in settings. I had to search not so obvious places in Internet, so I share this Q&A.

muru
  • 193,181
  • 53
  • 473
  • 722
Qback
  • 1,123
  • 1
  • 8
  • 13

2 Answers2

63

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

Ubuntu 22:

instead of xrandr -o normal you should use xrandr -orientation normal

Qback
  • 1,123
  • 1
  • 8
  • 13
  • 2
    How to persist this across restarts? – danjah Jun 10 '19 at 11:54
  • @danjah Unfortunately I didn't try to persist it. It's probably not the best solution, but you can try to add new line with `xrandr -o normal` to you `.bashrc` or `.bash_profile` file – Qback Jun 10 '19 at 11:59
  • This doesn't seem to work any more on Ubuntu 19.04 – rubo77 Oct 27 '19 at 23:01
  • 1
    a partly solution to rotate via keyboard shortcut is found here: https://unix.stackexchange.com/a/465395/20661 – rubo77 Oct 27 '19 at 23:17
  • Great answer. How do you do this with a dual monitor setup, where one should be flipped to normal mode and the other should be flipped left? – ComputerScientist Jan 10 '20 at 04:18
  • @ComputerScientist I'm sorry, I've never used Ubuntu with dual monitor :( – Qback Jan 10 '20 at 11:03
  • this appears to be a solution if you're running the x11 display system. What if it's just the server without that running? meaning only the terminal is being ran. – James Mertz Apr 23 '20 at 17:20
  • Found the answer here: https://askubuntu.com/a/452772/1805 – James Mertz Apr 23 '20 at 17:26
9

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

rubo77
  • 31,573
  • 49
  • 159
  • 281