Display setting in linux commands

How to find screen resolution in Linux desktop environment

One system setting that you often check or modify in Linux desktop environment is display setting, in particular, screen resolution. There are different ways to get display resolution information on Linux, either from the command line or from GUI-based display settings.

In this tutorial, I will describe how to find screen resolution in Linux desktop environment.

Method One: xdyinfo

One way to determine monitor resolution is via xdpyinfo , a command-line utility for showing information about an X server, including current display resolution. To check the current screen resolution from the command line, simply run:

$ xdpyinfo | grep "dimensions" | awk '< print $2 >'

Method Two: xrandr

The second screen resolution command is xrandr , a command-line interface for RandR (short for «X Resize, Rotate and Reflect Extension»). The xrandr command can show you the current screen resolution, as well as all possible display settings.

Screen 0: minimum 320 x 200, current 1366 x 768, maximum 8192 x 8192 LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm 1366x768 60.0*+ 40.1 1360x768 59.8 60.0 1024x768 60.0 800x600 60.3 56.2 640x480 59.9 VGA1 disconnected (normal left inverted right x axis y axis) HDMI1 disconnected (normal left inverted right x axis y axis) DP1 disconnected (normal left inverted right x axis y axis)

As you can see above, if you run xrandr command without any argument, you can get a list of all available screen resolutions. The currently set screen resolution is indicated with * marker. Therefore, to find the current display resolution only, use the following command.

Method Three: Display Settings

Every Linux desktop environment comes with its own GUI-based system settings, including display settings. Thus, you can use GUI-based display settings to determine the current screen resolution. To launch GUI-based display settings, you can use desktop-specific command line interface as demonstrated below.

To launch display settings on GNOME desktop environment, use either of the following commands:

$ gnome-control-center display

To launch display settings on KDE desktop environment, run:

To launch display settings on LXDE desktop environment, run:

Читайте также:  Hp pavilion linux drivers

To launch display settings on Xfce desktop environment, run:

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Источник

How To Configure Your Monitors With Xrandr in Linux

Just about every desktop environment comes with some way to configure and control your monitors, but some aren’t quite up to par, and bugs can be a factor. Then, there are tiling window managers and more minimal desktops that don’t have those utilities. In any of these cases, Xrandr, the Xorg’s own utility for monitor management is your best friend, and it’s not too hard to use.

In this tutorial you will learn:

  • How to Find Info About Your Monitors
  • How to Set Your Monitor Resolution
  • How to Set Your Monitor Refresh Rate
  • How to Manage Dual Monitor Setups

Configure Monitors With Xrandr

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Nearly All Linux Distros
Software Xrandr
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to Find Info About Your Monitors

Before you do anything, you’re going to need to find out a bit about your monitors, like how your system is referencing them, their available resolutions, and their refresh rates. You can accomplish all of this with a simple command to query your monitors.

Xrandr Monitor Info

The results might look complex, but they’re really simple, once you break them down. Each heading is actually a listing for one of the ports on your graphics card. They’ll be something like DisplayPort-0 or DVI-D-0 . Next to each one, you’ll see if it’s connected or disconnected. The connected ones are obviously the monitors that you have in use.

Next to that connection status, you’ll see whether that monitor is the primary. After that you’ll see a notation the current resolution of your monitor with position information, denoted by the plus signs. The first position is the x coordinate, and the second is the y . The primary monitor will have zeroes in these positions. A secondary monitor placed to the right, like in the image, will have +1920 or something similar in the x position.

The available resolutions are listed down the left side of what amounts to a table under each connected display. To the left of each resolution, you’ll find the available refresh rates for that resolution listed out going from left to right. There’s an asterisk(*) next to the refresh rate that your monitor is currently set at.

How to Set Your Monitor Resolution

Now that you have a general idea what your monitors are capable of, you can set the resolution of one. Take a look at the available resolutions. Then, use Xrandr to set it.

$ xrandr --output DVI-D-0 --mode 1920x1080

The —output flag is necessary to specify which monitor you’re targeting. Then the —mode flag tells it which resolution to use.

How to Set Your Monitor Refresh Rate

The —rate flag allows you to set your monitor’s refresh rate. Take a look at your monitor’s information. Select a rate that your monitor can use at its current resolution. Then, use the flag to set your monitor’s refresh rate.

$ xrandr --output DVI-D-0 --mode 1920x1080 --rate 60.00

How to Manage Dual Monitor Setups

The situation is similar for dual monitor set ups. Just specify the information for both monitors in your command. It should look something like this:

$ xrandr --output DisplayPort-0 --mode 1920x1080 --rate 144.00 --output DVI-D-0 --mode 1920x1080 --rate 60.00

Dual monitor set ups have some added flags that can be useful for positioning and priority. The —primary flag specifies the primary monitor. You can use the —left-of and —right-of flags to set the position of your other monitors. All together, it looks something like the example below.

$ xrandr --output DisplayPort-0 --primary --mode 1920x1080 --rate 144.00 --output DVI-D-0 --mode 1920x1080 --rate 60.00 --right-of DisplayPort-0

Conclusion

Xinitrc With Xrandr

You’re now ready to manage your monitors and provide specific detail straight to the X Server. It’s important to note that Xrandr is highly scriptable, and you can run it as a startup script. You can also include Xrandr statements in your .xinitrc file or run it as a script in your window manager’s startup.

Comments and Discussions

NEWSLETTER

Subscribe to Linux Career Newsletter to receive latest news, jobs, career advice and featured configuration tutorials.

WRITE FOR US

LinuxConfig is looking for a technical writer(s) geared towards GNU/Linux and FLOSS technologies. Your articles will feature various GNU/Linux configuration tutorials and FLOSS technologies used in combination with GNU/Linux operating system.

When writing your articles you will be expected to be able to keep up with a technological advancement regarding the above mentioned technical area of expertise. You will work independently and be able to produce at minimum 2 technical articles a month.

TAGS

  • VIM tutorial for beginners
  • How to install the NVIDIA drivers on Ubuntu 20.04 Focal Fossa Linux
  • Bash Scripting Tutorial for Beginners
  • How to check CentOS version
  • How to find my IP address on Ubuntu 20.04 Focal Fossa Linux
  • Ubuntu 20.04 Remote Desktop Access from Windows 10
  • Howto mount USB drive in Linux
  • How to install missing ifconfig command on Debian Linux
  • AMD Radeon Ubuntu 20.04 Driver Installation
  • Ubuntu Static IP configuration
  • How to use bash array in a shell script
  • Linux IP forwarding – How to Disable/Enable
  • How to install Tweak Tool on Ubuntu 20.04 LTS Focal Fossa Linux
  • How to enable/disable firewall on Ubuntu 18.04 Bionic Beaver Linux
  • Netplan static IP on Ubuntu configuration
  • How to change from default to alternative Python version on Debian Linux
  • Set Kali root password and enable root login
  • How to Install Adobe Acrobat Reader on Ubuntu 20.04 Focal Fossa Linux
  • How to install the NVIDIA drivers on Ubuntu 18.04 Bionic Beaver Linux
  • How to check NVIDIA driver version on your Linux system
  • Nvidia RTX 3080 Ethereum Hashrate and Mining Overclock settings on HiveOS Linux

LATEST TUTORIALS

  • Enabling SSH on Raspberry Pi: A Comprehensive Guide
  • Boot Your Raspberry Pi from a USB: A Tutorial
  • Checking Your Raspberry Pi’s OS Version
  • Install an OS on Your Raspberry Pi: Step-by-Step
  • Finding Your Raspberry Pi’s IP Address: A Quick Guide
  • Easy Steps to Update Your Raspberry Pi
  • Connecting Your Raspberry Pi to Wi-Fi: A How-To
  • How to install RealVNC viewer on Linux
  • How to check Raspberry Pi RAM size and usage
  • How to check Raspberry Pi model
  • Understanding UEFI and BIOS in Relation to Linux Nvidia Driver Installation
  • How to orchestrate Borg backups with Borgmatic
  • How to monitor filesystem events on files and directories on Linux
  • Debian USB Firmware Loader Script
  • How to install and self host an Ntfy server on Linux
  • How to backup your git repositories with gickup
  • How to bind an SSH public key to a specific command
  • Creating a Bootable USB for Windows 10 and 11 on Linux
  • How to list all displays on Linux
  • List of QR code generators on Linux

Источник

Оцените статью
Adblock
detector