Rotate screen on a RaspberryPi via CLI
RaspberryPi 3 and earlier
To rotate the screen on a RaspberryPi 3 and earlier add the following line to /boot/config.txt
:
display_hdmi_rotate=0
Replace the 0 with the desired rotation:
int | rotation |
---|---|
0 | normal |
1 | 90° |
2 | 180° |
3 | 270° |
Reboot your system to apply the changes.
RaspberryPi 4
On a RaspberryPi 4 you can use the xrandr
command:
DISPLAY=:0 xrandr --output HDMI-1 --rotate normal
DISPLAY=:0 xrandr --output HDMI-1 --rotate left
DISPLAY=:0 xrandr --output HDMI-1 --rotate right
DISPLAY=:0 xrandr --output HDMI-1 --rotate inverted
arg | rotation |
---|---|
normal | normal |
left | 90° |
right | 180° |
inverted | 270° |