Curious about your Linux desktop's screen resolution? Want to know how to find it using simple commands? Look no further! In this guide, we’ll walk you through the steps to find your Linux desktop screen resolution, both from the command line and using a graphical interface.
To check your monitor's resolution, refresh rate and other information on a Linux system, you can use several tools and commands.
First, we will learn how to display the screen resolution in Linux from command line.
Table of Contents
Find Desktop Screen Resolution in Linux from Command line
Here, we will use the following tools to find the screen resolution of your Linux desktop from command line:
- xrandr,
- xdpyinfo,
- inxi,
- edid-decode,
- dmesg.
1. Check Linux Desktop Screen Resolution using xrandr Command
The xrandr (stands for "X Resize and Rotate") is a command-line tool used in the X Window System, which is the underlying graphical system used by most Unix-like operating systems, including Linux.
The xrandr utility enables users to configure and manipulate various display settings, such as screen resolution, refresh rate, rotation, and more, directly from the command line.
With "xrandr," you can perform tasks like changing the resolution of your monitor, adjusting the orientation of your screen (landscape, portrait, etc.), setting up multi-monitor configurations, and diagnosing display issues.
This command is especially handy for those who prefer working with the command line or need to automate display-related tasks.
xrandr comes pre-installed in most Linux distributions.
To find your screen resolution in Linux using xrandr, simply run:
xrandr
This will output a list of all of the available display settings.
Screen 0: minimum 320 x 200, <strong><mark>current 1920 x 1080</mark></strong>, maximum 16384 x 16384 DP-1 disconnected (normal left inverted right x axis y axis) DP-2 disconnected (normal left inverted right x axis y axis) HDMI-1 disconnected (normal left inverted right x axis y axis) DP-3 connected primary <strong><mark>1920x1080</mark></strong>+0+0 (normal left inverted right x axis y axis) 476mm x 268mm <strong><mark>1920x1080</mark></strong> 60.00*+ 50.00 59.94 1600x900 60.00 1280x1024 75.02 60.02 1152x864 75.00 1280x720 60.00 50.00 59.94 1024x768 75.03 60.00 800x600 75.00 60.32 720x576 50.00 720x480 60.00 59.94 640x480 75.00 60.00 59.94 720x400 70.08 DP-4 disconnected (normal left inverted right x axis y axis)
As you see in the output above, my current Debian desktop resolution is 1920x1080 pixels.
You can also use xrandr command with the grep command to extract only the resolution and exclude other details.
xrandr | grep '*' | awk '{ print $1 }'1920x1080
Let's break down what each part of the above command does:
- xrandr: This command is used to query and configure display settings in the X Window System. When you run this command without any options, it displays information about the connected monitors and their available resolutions.
- | (Pipe): The pipe symbol (|) is used to take the output from the command on the left side and use it as input for the command on the right side.
- grep '*': This part of the code uses the "grep" command to search for lines containing an asterisk (*). In the context of "xrandr" output, an asterisk often indicates the currently active screen resolution.
- awk '{ print $1 }': This part of the code uses the "awk" command to print the first column of text from the lines that were filtered by the previous "grep" command. In the context of "xrandr" output, the first column usually represents the screen resolution.
Putting it all together, this command will filter the output of the "xrandr" command to extract the currently active screen resolution, which is often marked with an asterisk in the "xrandr" output. It uses the "grep" command to find lines with an asterisk and then uses "awk" to print the first column (which contains the resolution).
Related Read: How To Adjust Monitor Brightness From Command Line In Linux
2. Find Linux Desktop Screen Resolution using xdpyinfo Command
The xdpyinfo is a command-line utility in the X Window System that provides information about the display and the X server's capabilities. It stands for "X Display Information" and is used to retrieve various details about the X server and the connected displays.
When you run the xdpyinfo command, it provides a comprehensive set of information about the X server and the display it's running on. This information can include details about the screen size, color depth, available extensions, fonts, and more.
Xdpyinfo is useful for diagnosing display-related issues, checking the capabilities of the X server, and gathering information about the connected monitors.
For example, you can use xdpyinfo to find out the screen resolution, the number of available screens, the current color depth, and other relevant details about the display setup.
In summary, "xdpyinfo" is an useful tool for obtaining detailed technical information about the X server and the connected displays in a Unix-like operating system, including Linux.
To display the desktop screen resolution of your Linux system using the xdpyinfo utility, you'd use:
xdpyinfo | grep dimensions
This command will output information that includes the dimensions of your screen in pixels.
dimensions: 1920x1080 pixels (508x285 millimeters)
You can also use the grep and awk commands with "xdpyinfo" to extract the resolution only:
$ xdpyinfo | grep dimensions | awk '{print $2}' 1920x1080
Let's break down what each part of the command does:
- xdpyinfo: This command is used to retrieve detailed information about the X server and the connected display(s). When you run this command, it outputs a comprehensive set of information about the display configuration and capabilities of the X server.
- | (Pipe): The pipe symbol (|) is used to take the output from the command on the left side and use it as input for the command on the right side.
- grep dimensions: This part of the code uses the "grep" command to search for lines containing the word "dimensions." In the context of "xdpyinfo" output, lines containing "dimensions" typically provide information about the screen dimensions (resolution).
- awk '{print $2}': This part of the code uses the "awk" command to print the second column of text from the lines that were filtered by the previous "grep" command. In the context of "xdpyinfo" output, the second column usually contains the screen dimensions.
Putting it all together, the above command will filter the output of the "xdpyinfo" command to extract the screen dimensions (resolution) of the current display. It uses "grep" to find lines with the word "dimensions" and then uses "awk" to print the second column (which contains the resolution). The result is the display of the screen resolution of the current display.
The xdpyinfo tool also comes pre-installed in most Linux distributions. If the xdpyinfo command is not found for any reason, you can install it using the package manager for your particular Linux distribution.
For example, on Ubuntu or Debian, you would use:
$ sudo apt-get install x11-utils
And on Fedora, RHEL, AlmaLinux, Rocky Linux, you would use:
$ sudo dnf install xorg-x11-utils
On older RPM-based systems, use yum instead of dnf as shown below.
$ sudo yum install xorg-x11-utils
Keep in mind that these commands need to be run in a terminal on the Linux desktop itself. They won't return the correct results if run over a remote SSH session, unless you've set up X11 forwarding.
3. Display Monitor Resolution using Inxi
inxi is a powerful system information tool that can display monitor details.
Install inxi if it is not installed already:
sudo apt install inxi
Run the following command to display monitor information:
inxi -G
Look for the "Display" section, which will show the resolution and refresh rate.
Sample Output:
Graphics: Device-1: Intel Tiger Lake-LP GT2 [UHD Graphics G4] driver: i915 v: kernel Display: x11 server: X.Org v: 1.21.1.7 driver: X: loaded: modesetting unloaded: fbdev,vesa dri: iris gpu: i915 resolution: 1920x1080~60Hz API: OpenGL v: 4.6 Mesa 22.3.6 renderer: Mesa Intel UHD Graphics (TGL GT2)
4. Check Monitor Resolution and Refresh Rate using edid-decode in Linux
If you want detailed information about your monitor’s capabilities, including supported resolutions and refresh rates, you can use edid-decode to read the EDID (Extended Display Identification Data).
Install edid-decode if it’s not already installed:
sudo apt install edid-decode
Run the following command to extract the EDID information:
sudo cat /sys/class/drm/card1-DP-2/edid | edid-decode
Replace card1-DP-2 with the appropriate connector for your setup (e.g., card0-DP-1 for DisplayPort). You can find the correct connector by checking the /sys/class/drm/ directory.
Look for the "Detailed Timing Descriptors" section in the output. It will list all supported resolutions and refresh rates.
edid-decode (hex):00 ff ff ff ff ff ff 00 10 ac 09 20 01 01 01 0124 1f 01 03 80 30 1b 78 2a 69 25 a3 5b 50 a3 2711 50 54 a5 4b 00 71 4f 81 80 a9 c0 d1 c0 01 0101 01 01 01 01 01 02 3a 80 18 71 38 2d 40 58 2c45 00 dc 0c 11 00 00 1e 00 00 00 ff 00 30 50 3734 46 31 38 54 31 33 48 42 0a 00 00 00 fc 00 4532 32 31 39 48 4e 0a 20 20 20 20 20 00 00 00 fd00 38 4c 1e 53 11 00 0a 20 20 20 20 20 20 01 8f02 03 1a b1 4f 90 05 04 03 02 07 06 1f 14 13 1211 16 15 01 65 03 0c 00 10 00 02 3a 80 18 71 382d 40 58 2c 45 00 dc 0c 11 00 00 1e 01 1d 80 1871 1c 16 20 58 2c 25 00 dc 0c 11 00 00 9e 01 1d00 72 51 d0 1e 20 6e 28 55 00 dc 0c 11 00 00 1e02 3a 80 d0 72 38 2d 40 10 2c 45 80 dc 0c 11 0000 1e 00 00 00 00 00 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ee----------------Block 0, Base EDID: EDID Structure Version & Revision: 1.3 Vendor & Product Identification: Manufacturer: DEL Model: 8201 Serial Number: 16843009 Made in: week 36 of 2021 Basic Display Parameters & Features: Digital display Maximum image size: 48 cm x 27 cm Gamma: 2.20 DPMS levels: Off RGB color display First detailed timing is the preferred timing Color Characteristics: Red : 0.6376, 0.3574 Green: 0.3144, 0.6376 Blue : 0.1523, 0.0683 White: 0.3134, 0.3291 Established Timings I & II: IBM : 720x400 70.081663 Hz 9:5 31.467 kHz 28.320000 MHz DMT 0x04: 640x480 59.940476 Hz 4:3 31.469 kHz 25.175000 MHz DMT 0x06: 640x480 75.000000 Hz 4:3 37.500 kHz 31.500000 MHz DMT 0x09: 800x600 60.316541 Hz 4:3 37.879 kHz 40.000000 MHz DMT 0x0b: 800x600 75.000000 Hz 4:3 46.875 kHz 49.500000 MHz DMT 0x10: 1024x768 60.003840 Hz 4:3 48.363 kHz 65.000000 MHz DMT 0x12: 1024x768 75.028582 Hz 4:3 60.023 kHz 78.750000 MHz DMT 0x24: 1280x1024 75.024675 Hz 5:4 79.976 kHz 135.000000 MHz Standard Timings: DMT 0x15: 1152x864 75.000000 Hz 4:3 67.500 kHz 108.000000 MHz DMT 0x23: 1280x1024 60.019740 Hz 5:4 63.981 kHz 108.000000 MHz DMT 0x53: 1600x900 60.000000 Hz 16:9 60.000 kHz 108.000000 MHz (RB) DMT 0x52: 1920x1080 60.000000 Hz 16:9 67.500 kHz 148.500000 MHz Detailed Timing Descriptors: DTD 1: 1920x1080 60.000000 Hz 16:9 67.500 kHz 148.500000 MHz (476 mm x 268 mm) Hfront 88 Hsync 44 Hback 148 Hpol P Vfront 4 Vsync 5 Vback 36 Vpol P Display Product Serial Number: '0P74F18T13HB' Display Product Name: 'E2219HN' Display Range Limits: Monitor ranges (GTF): 56-76 Hz V, 30-83 kHz H, max dotclock 170 MHz Extension blocks: 1Checksum: 0x8f----------------Block 1, CTA-861 Extension Block: Revision: 3 Underscans IT Video Formats by default Supports YCbCr 4:4:4 Supports YCbCr 4:2:2 Native detailed modes: 1 Video Data Block: VIC 16: 1920x1080 60.000000 Hz 16:9 67.500 kHz 148.500000 MHz (native) VIC 5: 1920x1080i 60.000000 Hz 16:9 33.750 kHz 74.250000 MHz VIC 4: 1280x720 60.000000 Hz 16:9 45.000 kHz 74.250000 MHz VIC 3: 720x480 59.940060 Hz 16:9 31.469 kHz 27.000000 MHz VIC 2: 720x480 59.940060 Hz 4:3 31.469 kHz 27.000000 MHz VIC 7: 1440x480i 59.940060 Hz 16:9 15.734 kHz 27.000000 MHz VIC 6: 1440x480i 59.940060 Hz 4:3 15.734 kHz 27.000000 MHz VIC 31: 1920x1080 50.000000 Hz 16:9 56.250 kHz 148.500000 MHz VIC 20: 1920x1080i 50.000000 Hz 16:9 28.125 kHz 74.250000 MHz VIC 19: 1280x720 50.000000 Hz 16:9 37.500 kHz 74.250000 MHz VIC 18: 720x576 50.000000 Hz 16:9 31.250 kHz 27.000000 MHz VIC 17: 720x576 50.000000 Hz 4:3 31.250 kHz 27.000000 MHz VIC 22: 1440x576i 50.000000 Hz 16:9 15.625 kHz 27.000000 MHz VIC 21: 1440x576i 50.000000 Hz 4:3 15.625 kHz 27.000000 MHz VIC 1: 640x480 59.940476 Hz 4:3 31.469 kHz 25.175000 MHz Vendor-Specific Data Block (HDMI), OUI 00-0C-03: Source physical address: 1.0.0.0 Detailed Timing Descriptors: DTD 2: 1920x1080 60.000000 Hz 16:9 67.500 kHz 148.500000 MHz (476 mm x 268 mm) Hfront 88 Hsync 44 Hback 148 Hpol P Vfront 4 Vsync 5 Vback 36 Vpol P DTD 3: 1920x1080i 60.000000 Hz 16:9 33.750 kHz 74.250000 MHz (476 mm x 268 mm) Hfront 88 Hsync 44 Hback 148 Hpol P Vfront 2 Vsync 5 Vback 15 Vpol P Vfront +0.5 Odd Field Vfront 2 Vsync 5 Vback 15 Vpol P Vback +0.5 Even Field DTD 4: 1280x720 60.000000 Hz 16:9 45.000 kHz 74.250000 MHz (476 mm x 268 mm) Hfront 110 Hsync 40 Hback 220 Hpol P Vfront 5 Vsync 5 Vback 20 Vpol P DTD 5: 1920x1080 50.000000 Hz 16:9 56.250 kHz 148.500000 MHz (476 mm x 268 mm) Hfront 528 Hsync 44 Hback 148 Hpol P Vfront 4 Vsync 5 Vback 36 Vpol PChecksum: 0xee
5. View Monitor Information using dmesg
You can check the kernel logs for information about your monitor.
To do so, run:
sudo dmesg | grep -i hdmi
Or,
sudo dmesg | grep -i drm
Look for lines that mention the resolution or refresh rate.
Discover Desktop Screen Resolution in Linux from GUI
1. Using gnome-display
If you’re using a GNOME-based desktop environment (e.g., Ubuntu, Fedora), you can use theSettingsapp to check the resolution and refresh rate.
- Open Settings > Displays.
- The current resolution and refresh rate will be displayed under the monitor’s settings.
2. Using arandr
arandris a graphical front-end forxrandrthat allows you to view and manage display settings.
Install arandr:
sudo apt install arandr
Launch arandr from your application menu or by running:
arandr
The current resolution and refresh rate will be displayed in the window. If not, go to Outputs -> DP1 or DP2 or HDMI -> Resolution from arandr window.
Which Method Should You Use?
If you want to quickly check the current resolution and refresh rate, use xrandr. The xrandr command is the more powerful of the all methods. This is the fastest and simplest way to see the current resolution and refresh rate, as well as all supported modes.
If you want detailed monitor information (e.g., Model, Physical Size, Supported Features), Use edid-decode.
If you want to an easier method, use the xdpyinfo command. Please note that it does not provide as much information.
If you want to check system-wide display information, use Inxi. This provides a summary of your graphics card and monitor details, including resolution and refresh rate.
My Recommendation:
- Start with xrandr to quickly check the current resolution and refresh rate, as well as supported modes.
- If you need more details (e.g., monitor model, physical size), use edid-decode.
- If you prefer a graphical interface, use gnome-display or arandr.
Frequently Asked Questions
Q: How can I find my Linux desktop screen resolution using the command line?A: You have two main options: using the "xrandr" command or the "xdpyinfo" command. These commands provide detailed information about your display setup, including the screen resolution.
Q: How do I use the "xrandr" command to find my screen resolution and refresh rate?A: Open a terminal and type "xrandr" without quotes, then press Enter. Look for the line that corresponds to your primary monitor, which typically contains the screen resolution and refresh rateinformation.
Q: How to determine screen resolution using the "xdpyinfo" command?A: Open a terminal and type "xdpyinfo | grep dimensions" without quotes, then press Enter. The terminal will display the screen resolution of your current display.
Q: Can I extract only the screen resolution and exclude other details?A: Yes, you can. Use the command "xrandr | grep '*' | awk '{ print $1 }'" for "xrandr," and "xdpyinfo | grep dimensions | awk '{print $2}'" for "xdpyinfo." These commands will display only the screen resolution.
Q: Can I change my screen resolution using the command line?A: Yes, both "xrandr" and "xdpyinfo" can be used to change screen resolution. However, "xrandr" is the primary command for configuring display settings, including resolution changes.
Q: How do I check my monitor's physical size and model information?A: Use the edid-decode tool to read the EDID (Extended Display Identification Data) from your monitor: sudo cat /sys/class/drm/card0-DP-2/edid | edid-decode
Q: How do I check my monitor's details using inxi?A: Run the following command to display monitor information: inxi -G
Q: What if I'm using a different Linux distribution? Will the commands be the same?A: The commands themselves are likely to remain similar, but the package names and installation methods might vary depending on your distribution. Consult your distribution's package manager or documentation for precise instructions.
Conclusion
Find your desktop screen resolution from the CLI and GUI in Linux is easy! By using these tools and methods, you can easily check your monitor's current resolution and refresh rate, as well as its supported modes.
以上是如何从CLI和GUI找到Linux桌面屏幕分辨率的详细内容。更多信息请关注PHP中文网其他相关文章!

Linux的主要用途包括:1.服务器操作系统,2.嵌入式系统,3.桌面操作系统,4.开发和测试环境。Linux在这些领域表现出色,提供了稳定性、安全性和高效的开发工具。

互联网运行不依赖单一操作系统,但Linux在其中扮演重要角色。Linux广泛应用于服务器和网络设备,因其稳定性、安全性和可扩展性受欢迎。

Linux操作系统的核心是其命令行界面,通过命令行可以执行各种操作。1.文件和目录操作使用ls、cd、mkdir、rm等命令管理文件和目录。2.用户和权限管理通过useradd、passwd、chmod等命令确保系统安全和资源分配。3.进程管理使用ps、kill等命令监控和控制系统进程。4.网络操作包括ping、ifconfig、ssh等命令配置和管理网络连接。5.系统监控和维护通过top、df、du等命令了解系统运行状态和资源使用情况。

介绍 Linux是一个强大的操作系统,由于其灵活性和效率,开发人员,系统管理员和电源用户都喜欢。但是,经常使用长而复杂的命令可能是乏味的

Linux适用于服务器、开发环境和嵌入式系统。1.作为服务器操作系统,Linux稳定高效,常用于部署高并发应用。2.作为开发环境,Linux提供高效的命令行工具和包管理系统,提升开发效率。3.在嵌入式系统中,Linux轻量且可定制,适合资源有限的环境。

简介:通过基于Linux的道德黑客攻击数字边界 在我们越来越相互联系的世界中,网络安全至关重要。 道德黑客入侵和渗透测试对于主动识别和减轻脆弱性至关重要

Linux基础学习从零开始的方法包括:1.了解文件系统和命令行界面,2.掌握基本命令如ls、cd、mkdir,3.学习文件操作,如创建和编辑文件,4.探索高级用法如管道和grep命令,5.掌握调试技巧和性能优化,6.通过实践和探索不断提升技能。

Linux在服务器、嵌入式系统和桌面环境中的应用广泛。1)在服务器领域,Linux因其稳定性和安全性成为托管网站、数据库和应用的理想选择。2)在嵌入式系统中,Linux因其高度定制性和高效性而受欢迎。3)在桌面环境中,Linux提供了多种桌面环境,满足不同用户需求。


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

Atom编辑器mac版下载
最流行的的开源编辑器

MinGW - 适用于 Windows 的极简 GNU
这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能

Dreamweaver Mac版
视觉化网页开发工具

记事本++7.3.1
好用且免费的代码编辑器