Adjusting Screen brightness in Linux

Aung Myo Oo
Nov 13, 2020

Let’s write shell script to adjust screen brightness.

#!/bin/bash
# Bash script to control the monitor brightness
brightness_level=$1
screenname=$(xrandr | grep “ connected” | cut -f1 -d” “)
xrandr — output $screenname — brightness $brightness_level;

and save with your-name.sh
In this case we are using $1 as parameter for brightness level as we want to adjust.

So, at last we can run that .sh file as

sh your-name.sh 0.4

Brightness level range is 0 to 1.

That’s all thanks.

--

--