How to Change Display Brightness Using Command Line in Linux

This article will list various command line tools that can be used to control the brightness of display. These apps are especially useful if you are using a Linux distribution without graphical interface. Note that some of these tools may not work on your system depending on your hardware configuration and graphics card. This article will also list apps that don’t change hardware level brightness, but instead change gamma value or create a system wide tinted filter handled by software. All the apps and commands mentioned in the article are compatible with “X” display manager only (no Wayland support).

Xrandr (Software Level)

Xrandr is a command line app used to manage display output configuration. It can change resolution, orientation, handle multiple displays, and so on. To see your currently used display identifier, run the command below:

$ xrandr --prop | grep " connected"

You will see some output like this:

HDMI-A-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis)
 510mm x 287mm

The string just before the “connected” part is the identifier for your display (HDMI-A-0 in this case). You can now use the identifier to change the brightness of your display.

To check the current brightness value, use the following command:

$ xrandr --prop --verbose | grep -A10 " connected" | grep "Brightness"

To change the brightness, run the following command (replace HDMI-A-0 with your own display identifier):

$ xrandr --output HDMI-A-0 --brightness 0.4

Note that it doesn’t change hardware level brightness, it is just a software level filter with adjusted gamma values.

Xdotool (Hardware Level)

Xdotool is a command line utility that can be used to run simulated keystrokes and mouse clicks. It is possible to change brightness by simulating keypresses of brightness+ and brightness- buttons on your system.

To install xdotool in Ubuntu, run the following command:

$ sudo apt install xdotool

To increase brightness using xdotool, run the following command:

$ xdotool key XF86MonBrightnessUp

To decrease brightness using xdotool, run the following command:

$ xdotool key XF86MonBrightnessDown

Since xdotool simulates real hardware keypresses, this is a hardware level change of brightness.

Xgamma (Software Level)

Xgamma, as the name suggests, is a utility to manage gamma values of display. The changes made using xgamma are software level changes, so actual brightness of the monitor is not changed. Xgamma comes pre-installed on most Linux distributions.

To view current gamma values, run the command below (shows RGB values):

$ xgamma

To change the gamma value, run a command in the following format:

$ xgamma -gamma 0.60

Xbacklight (Hardware Level)

Xbacklight allows you to configure the backlight intensity of your display. To install it in Ubuntu, run the command below:

$ sudo apt install xbacklight

Xbacklight may not work on all hardware configurations. To confirm if it works on your system, run the command below:

$ xbacklight -get

If you don’t see any output, xbacklight won’t work on your system. To set the backlight brightness, run the command below:

$ xbacklight -set 0.60

Brightnessctl (Hardware Level)

Brightnessctl allows you to control display backlight and brightness of LED light indicators available on your hardware.

To install brightnessctl on Ubuntu, run the command below:

$ sudo apt install brightnessctl

To list all controllable devices, run the command below:

$ brightnessctl -l

It may not be easy to correctly identify display identifiers as the names may not be user friendly and you may have to resort to some guesswork to identify the monitor. In the screenshot above, the string for the monitor is “0005:054C:09CC.0005:global”. Once you have identified the correct name, run the command below to change the brightness:

$ brightnessctl -d “0005:054C:09CC.0005:global” set 60%

Redshift (Software Level)

Redshift is a command line tool that allows you to manually or automatically set the color temperature and/or brightness of your display.

To install redshift in Ubuntu, run the command below:

$ sudo apt install redshift

To change brightness using redshift, run the command below (0.60 for daytime, 0.70 for night-time, maximum is 1.0, minimum is 0.1):

$ redshift -b 0.60:0.70

In addition to brightness controls, redshift also comes with many options to change gamma values as well as color temperature. You can also supply your location to redshift so that display configuration can be changed automatically before and after sunset. Covering other configuration options is out of scope of this article. To see all available options, run one of the commands below:

$ redshift --help
$ man redshift

Conclusion

These are some of the methods you can use to control brightness or backlight intensity of your display. As stated earlier, some of these methods may not work on your hardware. It is best to try these tools yourself and choose one that works and best suited for your needs.



from Linux Hint https://ift.tt/3a8mEip

Post a Comment

0 Comments