Raspberry Pi

How to Find Desktop Screen Resolution from Command Line on Raspberry Pi

Linux enthusiasts who love to explore multiple Linux tools often try to explore the hidden details of a system, such as kernel information, vendor release number, display information and other such details. Even people who use a mini-computer such as Raspberry Pi often try to explore the different domains of the device.

This article is a specific guide to finding the desktop screen resolution from the command line on Raspberry Pi.

How to Find Desktop Screen Resolution from Command Line on Raspberry Pi

There are two ways to find the desktop screen resolution from the command line on Raspberry Pi:

Method 1: xdpyinfo Utility

The first method to find the screen resolution is the xdpyinfo utility, which is present on most Linux-based systems including Raspberry Pi. xdpyinfo utility displays general information related to how a Linux-based machine can be used as a server, it displays vendor release number, number of extensions and visual information. To display the screen resolution using xdpyinfo utility just simply run the below-written xdpyinfo command and along with other Linux details the display details will also be displayed:

xdpyinfo

If you want only directly to display the resolution, just run the below-mentioned command and it will display the resolution as an output:

xdpyinfo | grep "dimensions" | awk '{ print $2 }'

Method 2: By Using xrandr Utility

xrandr utility also comes pre-installed in Linux distributions; it belongs to the RandR (Rotate and Reflect) extension. The X in xrandr is for Resize along with Rotate and Reflect extension. Using the xrandr command, the output will display the current screen resolution along with other detailed visual-related information:

xrandr

To exactly display the resolution and no other details, you can run the xrandr utility by using the below-mentioned command:

xrandr | grep '*' | awk '{ print $1 }'

If you want to know more xrandr utility then you can open its manual for description using the below-written command:

man xrandr

Conclusion

To find the screen resolution from the command line on Raspberry Pi, there are two ways which are discussed in the article. One is by using the xdpyinfo utility and the other is by using xrandr utility. Both these utilities are installed by default in Raspberry Pi and you can use these utilities to find the desktop resolution from the command line.

About the author

Zahra Zamir

An Electronics graduate who loves to learn and share the knowledge, my passion for my field has helped me grasp complex electronics concepts and now I am here to share them with others.