Now I can change it by Fn+ arrow right but now I need to do it via my shell script
- 1,395
- 2
- 14
- 36
9 Answers
adding to what Michał Šrajer says in some cases the brightness may be controlled from /sys/class/backlight/acpi_video0/brightness as is the case with my dell vostro 3400 and my the brightness range is 0-15. You may have to look for other folder in /sys/class if the same path as mine doesnot exit.
- 23,668
- 12
- 72
- 85
-
it works (0-9 for me) – RiaD Aug 07 '11 at 17:31
-
See my comment on Michał Šrajer's post below for a way to alias this for easy use. – floer32 Nov 02 '12 at 12:24
-
How to change it? is not by `sudo nano /sys/class/backlight/acpi_video0/brightness` ... – Peter Krauss Dec 27 '17 at 14:05
-
2for me it was via `sudo vim /sys/class/backlight/intel_backlight/brightness` – Dara Java Aug 21 '18 at 22:11
-
Also, don't forget that instead of `vim`ing or `nano`ing to edit the file, you can simply `echo 15 > /sys/class/backlight/intel_backlight/brightness` – Damilola Olowookere May 17 '20 at 03:49
-
In my case it's `$ cat /sys/class/backlight/nvidia_wmi_ec_backlight/max_brightness` and `max_brightness` is 800. – Daniel Sep 02 '23 at 18:52
In your script you can send the equivalent keystrokes that correspond to Fn+Right Arrow and Fn+Left Arrow i.e. Brightness Up and Down respectively
Install xdotool from the Software Center
Then in your script to increase brightness:
xdotool key XF86MonBrightnessUp
To decrease Brightness
xdotool key XF86MonBrightnessDown
- 171,546
- 47
- 376
- 404
-
2
-
So I was able to do this in the terminal in Ubuntu 15.04 with both the MATE and Unity desktops. However, when I bind this to any key combination it does not work. – HarlemSquirrel Apr 18 '15 at 01:03
-
-
This still works (for me, at least) for XFCE on 18.04. Yet it doesn't allow to set to a fixed value, only steps up or down. – Stéphane Gourichon Jun 14 '18 at 20:32
-
I run `lxqt` on lubuntu 20_04, what should I write for `key`? `xdotool key XF86MonBrightnessDown` does not work. – Timo May 24 '21 at 18:23
You could install xbacklight package $sudo apt-get install xbacklight and then if you want to increase the brightness level, type $xbacklight -inc <level in a range of 10 - 100> and vice versa: $xbacklight -dec <level in a range of 10 - 100>.
Read xbacklight --help to see more options.
- 191
- 1
- 7
- 1,536
- 2
- 17
- 27
-
my notebook keyboard is broken, the external usb one has no key for that. the -dec option works, the -inc dont! but the -set does! so I will just create a simple script, thx!!! – Aquarius Power Jun 03 '17 at 03:31
-
call:
sudo su -c 'echo 30 > /proc/acpi/video/VID/LCD0/brightness'
The path may be different in your system. To list all available call:
find /proc/acpi/video -name 'brightness'
To see possible values for each, just cat the file:
cat /proc/acpi/video/VID/LCD0/brightnes
- 27,439
- 4
- 33
- 29
-
have not /proc/acpi/video/ at all. find /proc/acpi -name 'brightness' prints nothing – RiaD Aug 07 '11 at 17:03
-
-
-
2`sudo su -c 'echo 4 > /sys/class/backlight/acpi_video0/brightness'` worked for me. Using a Samsung laptop and oddly enough the range is 0-7. – floer32 Nov 02 '12 at 12:09
-
I tried to write a function to call this very easily - wound up with `function bri { sudo su -c 'echo $1 > /sys/class/backlight/acpi_video0/brightness';}` - but it didn't work for me. So as a substitute, I created aliases `bri0` through `bri7` which worked -- see [here](http://pastebin.com/ZX21bEvm). – floer32 Nov 02 '12 at 12:22
-
function brightness { sudo su -c "echo $1 > /sys/class/backlight/acpi_video0/brightness" } did the trick for me. – Max Wallace Mar 01 '15 at 19:14
-
Mine was under `/sys/devices/pci0000.../drm/card0/card0-eDP-1/intel_backlight/brightness`. `cd /sys; find -iname 'bright*'` is how I found it. – dhill May 25 '18 at 12:25
Install xbacklight it is very light and useful.
sudo apt-get install xbacklight
Then use xbacklight -set 60 where number can varry from 0 to 100.
- 131
- 4
Ubuntu's default desktop environment, Unity, has set of dbus methods that allow setting/getting brightness without need for sudo access.
Note well, that for this to work, one will need to have DISPLAY=:0 variable declared in the script.
Personally, I use qdbus application , with all the appropriate interface and method names combined into a nice function and store it in .bashrc
unityBrightness()
{ # change brightness in Unity/ Gnome
qdbus org.gnome.SettingsDaemon.Power\
/org/gnome/SettingsDaemon/Power\
org.gnome.SettingsDaemon.Power.Screen.SetPercentage "$1"
}
Usage of this function would be like :
unityBrightness 50
, where 50 is the percentage.
Equivalent dbus-send command would be
dbus-send --session --print-reply\
--dest=org.gnome.SettingsDaemon.Power\
/org/gnome/SettingsDaemon/Power \
org.gnome.SettingsDaemon.Power.Screen.SetPercentage uint32:"$1"
- 548
- 5
- 14
- 103,293
- 19
- 273
- 492
-
Getting `Error org.freedesktop.DBus.Error.UnknownMethod: No such method “SetPercentage”` :( – Rohlik Sep 29 '22 at 16:52
Here is a little utility to set brightness from terminal: linux-brightness-binary
Then you can set brightness like this: sudo bright 5 or sudo bright 0
0-15 works for me on Asus UX50V Laptop running Debian 7
- 111
- 6
On Ubuntu trusty 14.04, this command works fine
sudo su -c 'echo 12 > /sys/class/backlight/acpi_video0/brightness'
You can change the value 12 to any value from 0 to 20
Thanks @Michał Šrajer and @sagarchalise
- 344
- 4
- 12
If you are using laptop.
You can use this command: sudo setpci -s 00:02.0 F4.B=xx
Which xx is the brightness in hex ranging from 0 (brightest) to FF (no brightness at all). I Use E0 when working on battery.
- 16,322
- 10
- 56
- 65
-
1
-
@enzotib : It works fine with me using 11.04. And I think it is only for a laptop. – Binarylife Aug 07 '11 at 20:55
-
-
1
-
This is the only one that works for me on a Gateway / Packard Bell. – GenericJam Feb 20 '16 at 22:41
-
@Binarylife who do I undo this? Because I don't understand the command. I didn't think it changed my brightness. But the command ran without throwing an error. So, I wanted to undo this for future issues. – Pranav May 29 '21 at 07:26