Controlling the Linux Backlight via the Command-Line
This post's featured URL for sharing metadata is https://www.jvt.me/img/profile.jpg.
Let's say that you've just installed your laptop, and you've forgotten to install
xbacklight to manage your backlight settings, or you do have it, and it's randomly stopped working.
Fortunately on Linux,
sysfs allows you to interact with the backlight system, just by writing to "files" on disk, nothing else needed!
First, you'll need to check which devices are available. For instance:
ls -l /sys/class/backlight/ # on my laptop: total 0 lrwxrwxrwx 1 root root 0 Nov 10 12:08 intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight
Next, we can check what it's currently set to:
And to check the maximum available for the device:
And then if we want to control the brightness, we can write to the
brightness file with the brightness value we want to set it to:
echo 200 | sudo tee /sys/class/backlight/intel_backlight/brightness