Control Screen Brightness from Ubuntu Terminal

If you use your Ubuntu system at different times of the day, you may also need to change the brightness of your screen over and over again to make it easier on your eyes. Although there are ways to do this through the user interface, I mainly work at the command line and looked for a way to control the screen brightness in the terminal itself. Through some research, I found out that the process with Xrandr Utility is pretty simple. One or two commands will help you adjust the brightness to your liking.

In this article, we will describe how you can adjust the brightness of your monitor using the Ubuntu command line. This includes getting the name of your monitor and adjusting the brightness level, both using the Xrandr utility.

We have tested the commands and procedures mentioned in this article on an Ubuntu 20.04 LTS and also on the current Ubuntu 22.04 system.

Please follow these steps to adjust the screen brightness on a Ubuntu system:

Step 1: Open the Terminal

Open the Terminal application either by using the Ctrl+Alt+T shortcut or by accessing it through the application launcher search as follows:

Open Ubuntu Terminal

Step 2: Get the Monitor’s device name

In this step, we will fetch the name of the monitor currently connected to your Ubuntu system through the Xrandr tool. The Xrandr tool (an app component in Xorg) is a command-line interface for the RandR extension and can be used to set outputs for a screen dynamically, without any specific setting in xorg.conf. This utility is installed, by default, on a Ubuntu 18.04 system.

Run the following command in your Terminal to fetch your monitor’s name:

$ xrandr | grep " connected" | cut -f1 -d " "

get name of the monitor device

I am using an LCD laptop and the output suggests the name of my monitor as LVDS-1

Step 3: Change the brightness level

Now that you know your monitor’s name, you can set the new brightness level through the following command syntax:

$ xrandr --output [monitor-name] --brightness [brightness-level]

The brightness level should be set between 0.5 to 1 for better visibility.

I used the following command to set my brightness level to 0.75 which is about right for using the laptop at night.

$ xrandr --output LVDS-1 --brightness 0.75

Change screen brightness from the shell

Through this simple tool, that comes already installed on your Ubuntu, you can adjust the brightness of your screen right from your command line.