How to use the command brightnessctl (with examples)
- Linux
- December 25, 2023
Brightnessctl is a utility command for reading and controlling device brightness on GNU/Linux operating systems. It provides a simple and efficient way to adjust the brightness of the display backlight. This article will illustrate various use cases of the brightnessctl command.
Use case 1: List devices with changeable brightness
Code:
brightnessctl --list
Motivation: This use case is helpful when you want to see a list of devices on your system that have changeable brightness levels. It allows you to identify the devices that can be controlled using brightnessctl.
Explanation: The --list
flag is used to list all devices with changeable brightness. When you run the command, it will display the device name and path for each device that supports brightness control.
Example output:
Device: intel_backlight
Path: /sys/class/backlight/intel_backlight
Max brightness: 4882
Current brightness: 2441
Use case 2: Print the current brightness of the display backlight
Code:
brightnessctl get
Motivation: Sometimes you need to know the current brightness level of the display backlight. This use case allows you to quickly retrieve this information.
Explanation: The get
argument is used to print the current brightness value of the display backlight. When you run the command, it will display the current brightness value as a percentage.
Example output:
50%
Use case 3: Set the brightness of the display backlight to a specified percentage within range
Code:
brightnessctl set 50%
Motivation: Adjusting the brightness of the display to a desired level is often necessary for optimal viewing experience. This use case lets you specify the desired brightness as a percentage and set it accordingly.
Explanation: The set
argument followed by a percentage value is used to set the brightness of the display backlight. When you run the command, it will adjust the brightness to the specified percentage.
Example output: None (successful execution)
Use case 4: Increase brightness by a specified increment
Code:
brightnessctl set +10%
Motivation: If you want to incrementally increase the brightness of the display backlight, this use case is suitable. It allows you to specify the desired increment and apply it to the current brightness level.
Explanation: The set
argument followed by a positive percentage value is used to increase the brightness. When you run the command, it will increment the brightness by the specified percentage.
Example output: None (successful execution)
Use case 5: Decrease brightness by a specified decrement
Code:
brightnessctl set 10%-
Motivation: Lowering the brightness of the display backlight can be necessary in various situations, such as reducing eye strain in low light environments. This use case allows you to specify the desired decrement and adjust the brightness accordingly.
Explanation: The set
argument followed by a negative percentage value is used to decrease the brightness. When you run the command, it will decrease the brightness by the specified percentage.
Example output: None (successful execution)
Conclusion:
The brightnessctl command provides a convenient way to read and control the brightness of devices on GNU/Linux operating systems. With its various use cases illustrated in this article, you can easily list devices with changeable brightness, retrieve the current brightness value, set brightness to a specific percentage, increase brightness by an increment, and decrease brightness by a decrement. This utility enables you to customize the brightness settings according to your preferences and environmental conditions.