Now I can change it by Fn+ arrow right but now I need to do it via my shell script
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.
- 24,306
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
- 174,526
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,542
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
- 28,899
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
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"
- 558
- 107,582
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
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
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,662