How to modify laptop’s screen brightness from a bash script

Using a direct access to /sys/class/backlight

My Debian laptop is configured with a very minimal setup, using i3 as window manager and without any graphical tool for system management.

To manage the screen brightness i choosed not using a specific command line tool: i use the script below that directly access to the backlight handler under /sys/class/backlight

The script allow to increase or decrease the screen brightness with a single paramether passing the variation percentage:

# +20 (Increase brightness by 20%)


# -20 (Decrease brightness by 20%)

Finally, i have mapped this script to the functions keys of my laptop, with this lines in ~/.i3/config

bindsym XF86MonBrightnessUp exec +20
bindsym XF86MonBrightnessDown exec -20

Related posts

  1. Cybersecurity Roundup #15
  2. Why Huawei USB stick setup on linux adds a strange “Huawei Autorun” script in system start?
  3. LinuxCheck: Linux information gathering tool
  4. Quick mount of iOS Apps documents on Linux, using iFuse and bash
  5. i3: how to make a pretty lock screen with a small bash script