Software & AppsOperating SystemLinux

Rotating Display in Command Line: No X Server

Ubuntu 9

In the world of Linux, the X Server is a graphical interface that provides a bridge between the operating system and graphical applications. However, there might be instances where you are not using an X Server or are viewing a Virtual Console/Terminal. In such cases, if you need to rotate your display, you can use the fbcon utility. This article will guide you through the steps to rotate your display in the command line without an X Server.

Quick Answer

Yes, it is possible to rotate your display in the command line without an X Server by using the fbcon utility. You can use the echo command to set the rotation value for the current framebuffer or all virtual framebuffers. Additionally, you can apply the rotation automatically at system start by modifying your boot loader configuration file.

Understanding Fbcon

Fbcon is a system utility that deals with the Linux framebuffer console. It can be used to change the orientation of your display in the command line. The Linux framebuffer console is a graphic hardware-independent abstraction layer to show graphics on a computer monitor, specifically on the console.

Rotation Values

Before we delve into the commands, it’s important to understand the rotation values that fbcon uses:

  • 0 – Normal rotation
  • 1 – Rotate clockwise
  • 2 – Rotate upside down
  • 3 – Rotate counter-clockwise

Rotating the Current Framebuffer

To rotate the current framebuffer, open a terminal or console window and run the following command:

echo [rotation_value] | sudo tee /sys/class/graphics/fbcon/rotate

Replace [rotation_value] with your desired rotation value (0, 1, 2, or 3). For instance, if you want to rotate your display clockwise, you would use the command:

echo 1 | sudo tee /sys/class/graphics/fbcon/rotate

In this command, echo is used to output the rotation value, and sudo tee is a command that writes the output to the /sys/class/graphics/fbcon/rotate file with root permissions.

Rotating All Virtual Framebuffers

If you want to rotate all virtual framebuffers, use the following command:

echo [rotation_value] | sudo tee /sys/class/graphics/fbcon/rotate_all

This command works similarly to the previous one, but it applies the rotation to all virtual framebuffers.

Applying Rotation Automatically at System Start

To apply the rotation automatically when your system starts, you need to modify your boot loader configuration file. Follow these steps:

  1. Open the /etc/default/grub file using a text editor with the command:
sudo nano /etc/default/grub
  1. Locate the GRUB_CMDLINE_LINUX line and add fbcon=rotate:[rotation_value] to it. For example:
GRUB_CMDLINE_LINUX="fbcon=rotate:1"
  1. Save the file and exit the text editor.
  2. Update the boot loader configuration by running the following command:
sudo update-grub

After following these steps, your display should be rotated according to the specified rotation value whenever you start your system.

Conclusion

Rotating your display in the command line without an X Server is a straightforward process thanks to the fbcon utility. Whether you’re rotating the current framebuffer or all virtual framebuffers, or even setting the rotation to be applied automatically at system start, fbcon provides an easy-to-use solution. However, do note that the availability and functionality of the fbcon utility may vary depending on your system configuration and hardware.

Can I rotate my display in the command line without an X Server?

Yes, you can rotate your display in the command line without an X Server by using the fbcon utility.

What is the Linux framebuffer console?

The Linux framebuffer console is a graphic hardware-independent abstraction layer to show graphics on a computer monitor, specifically on the console.

How do I rotate the current framebuffer?

To rotate the current framebuffer, open a terminal or console window and run the following command:

echo [rotation_value] | sudo tee /sys/class/graphics/fbcon/rotate

Replace [rotation_value] with your desired rotation value (0, 1, 2, or 3).

Can I rotate all virtual framebuffers?

Yes, you can rotate all virtual framebuffers by using the following command:

echo [rotation_value] | sudo tee /sys/class/graphics/fbcon/rotate_all

This command applies the rotation to all virtual framebuffers.

Leave a Comment

Your email address will not be published. Required fields are marked *