Last updated on April 7th, 2023 at 08:10 am.
/sys/class is a virtual file system on Linux that exposes information about various kernel classes. It provides an interface for retrieving and editing various info about different hardware components, drivers, and subsystems in a Linux system. Each directory inside /sys/class represents a different class of PC devices.
You can do ls /sys/class to see what is inside there. The files inside each directory provide different information and control over the corresponding device. The data in /sys/class is dynamic and reflects the current state of your system.
Why reduce the screen/monitor brightness like this?
You are probably wondering why you would need to reduce your screen brightness using the short method described on this post. The reason is simply that, you need to reduce your screen brightness way below what is provided for by the default options of your system brightness settings. Use this method to lower brightness way below the lowest option provided by the screen settings.
Changing the screen brightness using /sys/class
To check current brightness level of your screen, run:
Change permissions of the sys/class file responsible for screen brightness to be editable:
sudo chmod o+w /sys/class/backlight/intel_backlight/brightness
Then decrease the brightness to any level you prefer, for instance 300. After running the command below, you will notice the brightness change immediately:
echo "300" > /sys/class/backlight/intel_backlight/brightness
For security, revert the permission of the file back to original after editing it:
sudo chmod 644 /sys/class/backlight/intel_backlight/brightness
Here’s one line to do it all. Just remember to change brightness value from 300 to your choice.
sudo chmod o+w /sys/class/backlight/intel_backlight/brightness && echo "300" > /sys/class/backlight/intel_backlight/brightness && sudo chmod 644 /sys/class/backlight/intel_backlight/brightness
More options for editing screen brightness can be found in the answer here.