Screen brightness adjustment is one of the basic tasks on any computer, and often required. However adjusting screen brightness on Linux could be a bit problematic.
Specially on laptops, as there's no dedicated hardware switch directly connected to the display.
Almost on every laptop the brightness up and down keys are combined with another key as a key combination, generally the
On some laptops it just works out of the box by default. But it may require some tweaking to get the screen brightness adjustment working.
Adjust Linux screen brightness
Here we'll discus about few different method to control brightness the same. Each method usability is depending on the hardware platform you're using like a laptop or desktop.
There's many GUI tool like XFCE Power Manager, to adjust the brightness. But here we'll focus on the command line tools.
1. Enable ACPI backlight keys
If the laptop's default brightness adjustment keys are not working, then add a boot time linux kernel parameter and try again.
- First open up the
/etc/default/grubfile with your favorite text editor as root.
sudo nano /etc/default/grub
- Find the line staring with
GRUB_CMDLINE_LINUX_DEFAULT=, most probably there will be the word quiet also.
- Add a few words there,
acpi_backlight=vendorall inside the double quote.
- Save and exit the text editor and then reboot the laptop.
acpi_backlight kernel parameter options are not just limited to vendor, and it's guaranteed to work.
You might have to experiment with other options like
none . After rebooting if the brightness adjustment hotkeys are working then you can set a laptop's brightness with the xbacklight command.
If it's not installed, then install it with apt,
sudo apt-get install xbacklight , and then run the command like below.
xbacklight -set 20 # set brightness to 20%
2. Change brightness on Linux through sysfs
If the brightness adjustment key's are not working even after adding the kernel parameters, then you could try to directly manipulate the sysfs interface.
The display backlight related sysfs parameters are under the
/sys/class/backlight/ directory. And there might be more than one controller interface.
In my case it's
acpi_video0, however it's not possible to change brightness with the second interface, in mu case.
So, first you might want to get an overview, what's actually inside that directories, use the ls command.
As you might have guessed, all the options there are quite straight forward to understand.
The value inside the max_brightness file is the maximum brightness you can assign to the display, and it's not possible to change.
The brightness file actually controls the amount of backligh, you can change it like below.
[email protected]:~# echo 200 > /sys/class/backlight/intel_backlight/brightness
And of course you need root privilege to manipulate that file.
The same thing as also applicable for the
acpi_video0 directory, you can adjust linux screen brightness from there, only if it's supported. An example below.
echo '3' > /sys/class/backlight/acpi_video0/brightness # set brightness level 3
3. Using Xrandr command to adjust Linux screen brightness
If it's a desktop or an external monitor is connected to a laptop with a VGA or HDMI cable, then the above method's won't work.
Every external monitor has some kind of remote or dedicated switch to control the brightness, contrast, color saturation etc. etc.
But that might not be enough, to lower the brightness even below the monitor vendor's lowest level, you've to use the
xrandr Linux command line tool.
Few examples in the below list.
- For the internal display of a laptop, which is connected via LVDS, use
xrandr --output LVDS1 --brightness 0.8
- If the monitor is connected to a HDMI port then use
xrandr --output HDMI1 --brightness 0.7
- If the monitor is connected to a VGA port, then
xrandr --output VGA1 --brightness 0.8
- Or if it's a Display Port, use
xrandr --output DP1 --brightness 0.6
Simply you could say the brightness value 0.8 means 80% of the full display brightness, or 0.6 means 60%.
It's basically monitor's gamma adjustment, don't use anything above 1, it will whiten the display.
And it doesn't actually reduce the amount of backlight, more like a transparent black shadow over the display. Still better than nothing, easy on eyes. Read more about the xrandr command here.
It's a short quick tip, hope yo're now a little more familiar with Linux screen brightness adjustment.
If you have any question, suggestion and other methods to suggest, please leave commands below.