I am try to make a program that control the bright of Linux OS, but I need to know how to control the monitor backlight just using terminal commands? I need to be able to increase, decrease. And also dim screen (and return undo dim) if it is possible too.
9 Answers
There are many possibilities. Just to name a few:
1.Bare echo
echo 8 > /sys/class/backlight/intel_backlight/brightness
For this to work, the user must be in the video
group.
Look at /sys/class/backlight/intel_backlight/max_brightness
to see what maximum brightness is supported.
2.The simplest to use
Install xbacklight
package and then try
xbacklight -inc 20 # increase backlight by 20%
xbacklight -dec 30 # decrease by 30%
xbacklight -set 80 # set to 80% of max value
xbacklight -get # get the current level
3.Over sophisticated
Run xrandr --verbose
and look for a line with resolution like LVDS1 connected 1024x600+0+0
. The name of your display (LVDS1 in this example) is needed here. Now you are ready to set brightness
xrandr --output LVDS1 --brightness 0.4
But this sets only software, not hardware brightness so you can exceed the limits (in both directons). Don't expect beautiful results but if you are brave enough to experiment a little bit then fasten your seatbelt and run
xrandr --output LVDS1 --brightness 1.7
xrandr --output LVDS1 --brightness -0.4 #yes, negative value is possible
xrandr --output LVDS1 --brightness 1
You can torture more your display with xrandr, but be ready to reboot your computer if something goes wrong. For example play with the following
xrandr --output LVDS1 --reflect x
xrandr --output LVDS1 --reflect xy
xrandr --output LVDS1 --reflect normal # return to normal state
xrandr --output LVDS1 --rotate left
xrandr --output LVDS1 --rotate inverted
xrandr --output LVDS1 --rotate normal # again, back to normal

- 2,665
- 2
- 29
- 38
-
I still got permission denied after my user was added to the video group (even after I restarted) – Carlos Pinzón Jan 10 '21 at 16:45
-
I used text editor to modify 'brightness' file successfully. On my machine 'backlight/intel_backlight' was separate from other ways to set brightness, so the answer helped a lot. – Nefedov Efim Apr 25 '21 at 16:18
An alternative to bare echo with XFCE4 Power Manager
On my DELL Inspiron 11 xbacklight
doesn't work ("No outputs have backlight property"). The bare echo method as described by user362097 does work.
If you're using Xubuntu or some distribution using the XFCE4 Power Manager, you can use xfpm-power-backlight-helper:
pkexec xfpm-power-backlight-helper --get-max-brightness
# I get 6009
pkexec xfpm-power-backlight-helper --set-brightness 1000

- 675
- 8
- 12
For externally connected monitors there are Linux utilities that support DDC/MCCS, the VESA standard for controlling monitor settings from a PC. MCCS commands can be issued via i2c (kernel i2c-dev module) to DVI, DisplayPort, HDMI monitors, or USB for USB connected monitors. I've found the command line utility ddcutil to be a reliable DDC/MCCS tool. If you need a small system-tray front end to ddcutil, I've written vdu_controls (a python Qt script). I've written a brief intro to vdu_controls, ddcutil and DDC/MCCS in an OpenSUSE forum post.
% ddcutil --display 2 getvcp 10
VCP code 0x10 (Brightness): current value = 50, max value = 100
% ddcutil --display 2 setvcp 10 90

- 526
- 6
- 8
-
This seems to be the correct approach to set the _hardware_ brightness of _external_ (HDMI, DP, etc) displays. Most (all?) other answers apply to internally connected (laptop) displays (xbacklight) or just change the output signal, not the actual backlight (xrandr --brightness). Dccutil basically is a way to set through software what you would otherwise do through the monitors OSD. – AVee Mar 15 '22 at 20:03
-
the other solutions not work for me, HDMI external monitor. This one works. – gdm Jul 14 '23 at 07:37
Why torture yourself? Wouldn't you rather a nice gui?
This simple script is written to work with the backlight system, mentioned in @user3620917's answer as "Bare Echo". But, once you figured out whatever command works on your system, you can adapt this slider to work with it.
It requires the small yad, which consumes little RAM, and leaves nothing running in the background when you close the slider. To understand the basic function, and to ensure you have yad, try this at a command-line:
yad --scale --print-partial
full script:
#!/bin/sh
BrPath='/sys/class/backlight/intel_backlight/'
BrCur=`cat ${BrPath}brightness`
BrMax=`cat ${BrPath}max_brightness`
BrMin=$(( (BrMax + (100 - 1)) / 100)) # 100th max-brightness, rounded up to nearest integer
yad --scale --min-value $BrMin --max-value $BrMax --value $BrCur --print-partial --title 'Set brightnessradky's Dpup Stretch 7.5 (RC3)' --width 300 --fixed --sticky --mouse --on-top --escape-ok --button OK --hide-value | while read BrNew
do echo "$BrNew" > ${BrPath}brightness
done
Explanation of all options: https://www.mankier.com/1/yad
To install:
Confirm the simple echo command works on your machine. Try various values and see if your brightness changes.
echo 10000000 > /sys/class/backlight/intel_backlight/brightness
Confirm yad works:
yad --scale --print-partial
save the script in a file called set-brightness
- if needed, edit the
BrPath=
line to match your backlight path. - put the script into /usr/local/bin
- create a launcher on your panel or desktop, which runs the command set-brightness. Since it's in /usr/local/bin, your OS should find it-- no need to enter entire path.
Causes of failure:
- Your backlight path might not be intel. Figure out which backlight path is correct for your machine https://askubuntu.com/questions/437983/how-to-find-backlight-is-managed-by-which-card
- You might have an old yad installed, or not installed at all. http://archive.ubuntu.com/ubuntu/pool/universe/y/yad/
If you're not running as root, you may need to give your user (or all users) write-permissions on the brightness file
chmod 666 /sys/class/backlight/intel_backlight/brightness
You might have characters in your yad 'title' parameter that some versions of yad might not like, such as parens. (parens work for me, ymmv).

- 2,047
- 7
- 27
- 52
-
I found your solution interesting, with `sudo` worked smooth. I had to update the title to `'Set brightnessradkys Dpup Stretch 7.5'`. – necrifede Sep 14 '19 at 20:59
-
I don't see any changes in the screen though, even when I adjust the backlight to 100 – Snow Mar 18 '20 at 08:58
Hey guys here I will tell you easiest one to control your screen's brightness.
Here parameters range is 100-999 depending on your requirement adjust number in command line below
echo 200 | sudo tee /sys/class/backlight/intel_backlight/brightness
Hope it will be helpful to you.

- 49,509
- 18
- 174
- 171

- 11
- 2
-
Wow! This worked like magic for HP convertible laptop. Though, the brightness ranges from 0-7500. **Care needs to be taken not to put in very low single or double digit brightness values as it might make it difficult to see the screen at all.** – Martin Medro Apr 11 '21 at 12:47
I was looking for a command to adjust the backlight of a laptop's LCD panel running Fedora 30 XFCE.
For some reason xbacklight didn't work I also suppose that even if xbacklight worked in a graphical environment, like under X server, it wouldn't work in runlevel 3, in a virtual console So I found brightlight which works great for now, it works both under XFCE and in runlevel 3. Install with
sudo dnf install brightlight
for info running the command type:
brightlight -h

- 31
- 2
-
Even thought your answer looks fine. There is a higher quality (and accepted) one already. – Cabrra Aug 27 '19 at 21:28
If you want to change it at the hardware level then it depends on which graphics card you have. I have radeon card + intel integrated card. So I change brightness by the following scripts for the 3 tasks you mentioned.
- Increase brightness
cb=$(cat /sys/class/backlight/intel_backlight/brightness) nb=$(($cb + 50)) echo $nb > /sys/class/backlight/intel_backlight/brightness notify-send -t 1 -a "My Brightness controller" $nb
- Decrease brightness
cb=$(cat /sys/class/backlight/intel_backlight/brightness) nb=$(($cb - 50)) echo $nb > /sys/class/backlight/intel_backlight/brightness notify-send -t 1 -a "My Brightness controller" $nb
- Dim screen
cb=$(cat /sys/class/backlight/intel_backlight/brightness) if [ $cb -ne 0 ] then nb=0 echo $cb > /home/prem/Documents/sys_files/old_bright else nb=$(cat /home/prem/Documents/sys_files/old_bright) fi echo $nb > /sys/class/backlight/intel_backlight/brightness
In your case you may need to change the folder name from Intel, depending on your GPU.

- 1
- 2
step1: open terminal ctrl+alt+t
step2:xrandr | grep " connected" | cut -f1 -d " "
step3:xrandr --output [monitor-name] --brightness [brightness-level]
example: xrandr --output LVDS-1 --brightness 0.75
The brightness level should be set between 0.5 to 1 for better visibility.

- 1
- 1
-
1xrandr doesn't alter the physical backlight brightness, it just shifts the X11 output towards or away from the the existing set maximum. So if you're backlight is at 13%, increasing brightness with xrandr will just squish up the brightness range toward 13%. – Michael Hamilton Sep 08 '21 at 21:01
Here is the simple command to control brightness in any linux based system
First you have to know the monitoring screen connected to your computer.
To know this, run this command
xrandr -q
It will give useful information about screen
Here my screen connected to eDP
It might be different for you system
After knowing that run the below command
xrandr --output eDP --brightness [0-10]
Replace eDP by your connected screen from above output and you can have normal brighness values from 0.1 to 1.0

- 30,962
- 25
- 85
- 135

- 104
- 9