Is it possible to set the default display brightness so you don't have to re-adjust it everytime you reboot? My laptop display is killing my eyes at the login screen already because it starts at 100% brightness every time.
5 Answers
Review of solutions and offering a (hopefully) better one
Previous solutions
/sys/
-based : good for console
@gan
This works echo 5 > /sys/class/backlight/acpi_video0/brightness
but does not play well with X. More specifically, X is not aware about your preferred settings and you may end up needing to set the brightness manually again at least once, similar to bug #1042359 .
setpci
-based : system-dependent, dangerous
@erickjohncuevas
Solutions based on things like setpci -s 01:00.0 F4.B=50
are dangerous. There, 01:00.0
is actually an ID targeting a particular board on the PCI bus. And it is system-dependent. That means blindly following this may write configuration registers on some other boards where it may mean anything, from just nothing to crashing the system at some point in the future. Anyway it does not play well with X either.
Proposed solution
Advantages/drawbacks
The solution below has these advantages:
- plays nice with X which is fully aware of the settings chosen
- is more readable, thus maintainable
- does not contain system-specific address, etc, and as a result may work on a wider range of hardware (e.g. where kernel does not know about backlight, or that don't even use PCI-based video board, think Ubuntu for ARM )
It assumes: Ubuntu using lightdm (that is 11.10 and beyond)
It only sets backlight when lightdm starts. But it can be combined with the /sys
-based solution above if you really need to set backlight earlier.
The solution
Copy-paste of these commands should do what you need (sudo
will probably ask your password).
Install
xbacklight
if it is not already installed (it is a small package).sudo apt-get install xbacklight
You should test
xbacklight
on the command-line to see if it works. For example:xbacklight = 100 ; sleep 2 ; xbacklight = 30
Try to figure out a suitable value for your hardware and lighting conditions.
Create a small script running
xbacklight
.
You can change the=30
into another value if you wish.
The|| true
ensures that ifxbacklight
fails for any reason, X can still start.sudo bash -c '{ echo "#!/bin/bash" echo "xbacklight =30 || true" } >> /etc/lightdm/display-setup-script.sh '
Make the script executable
sudo chmod a+rx /etc/lightdm/display-setup-script.sh
Instruct
lightdm
to run the script when starting X.
Specifically, this adds a line display-setup-script in a lightdm configuration file, but only if there is not one already.if grep -ri ^display-setup-script /etc/lightdm/ then echo "There may be already a display-setup-script. It may already do what you need. Else please adjust manually" ; else if [[ -d /etc/lightdm/lightdm.conf.d ]] then # Ubuntu 13.10 and above have lightdm.conf.d. 14.04 *only* has lightdm.conf.d. DEST_CONF_FILE=/etc/lightdm/lightdm.conf.d/20-default-brightness.conf else # Ubuntu 12.04, 12.10, 14.10 do not have lightdm.conf.d, so we change main configuration file DEST_CONF_FILE=/etc/lightdm/lightdm.conf fi echo "Writing into $DEST_CONF_FILE" sudo bash -c "{ echo '[SeatDefaults]' ; echo display-setup-script=/etc/lightdm/display-setup-script.sh ; } >> $DEST_CONF_FILE" ; fi
May be tested by restarting lightdm
from a root session on the console. Or, more simply, by rebooting.
Tested on Ubuntu 12.04, 12.10, 13.10, 14.04, 14.10, 16.04.
Please provide feedback about your experience.

- 163

- 2,069
-
1On a freshly installed Ubuntu 12.10, copy-paste of the lines above just works. – Stéphane Gourichon Jan 02 '13 at 15:38
-
-
On a freshly installed Xubuntu 13.10, copy-paste of the lines above just works. – Stéphane Gourichon Nov 07 '13 at 05:41
-
Adjusted just now for Ubuntu 14.04, tested, works. If xbacklight fails, does not prevent X from starting. – Stéphane Gourichon Jul 06 '14 at 21:46
-
1Works on 14.10. (Strangely enough, Ubuntu 14.10 reverts to having
/etc/lightdm/lightdm.conf
but not/etc/lightdm/lightdm.conf.d
. This solution still works anyway.) – Stéphane Gourichon Aug 13 '15 at 09:45 -
@wjandrea Thank you for your edits, indenting is good, variable names fine. Changing overall markup decision feels debatable. Most people (95%?) want something for instant copy-paste. Some people like to read code to understand what it does. A script block with in-script comments seemed to fit perfectly. List markup makes comments more salient, at the cost of hindering the straight copy-paste into terminal option. In doubt I let your edits go on. Thanks for participating. – Stéphane Gourichon Dec 06 '16 at 06:48
-
@StéphaneGourichon Thanks for the solution! It worked for me. The reason I switched from code format to list is to better show the steps for beginners, and make it easier to read for everyone else. A reader can copy-paste the individual commands and accomplish the same thing you intended. – wjandrea Dec 06 '16 at 14:51
-
On Ubuntu 18.04,
xbacklight
no longer works: "No outputs have backlight property". Directly playing with/sys/class/backlight/*/brightness
works. I might adjust the script. – Stéphane Gourichon May 29 '18 at 18:24 -
Trying this on Ubuntu 22.04 after installing xbacklight with sudo command and testing with this : xbacklight 30 I am getting this error message : No outputs have backlight property. Running echo$? is giving output 1 which means previous command didn't run properly. – user76170 Mar 17 '23 at 17:50
Actually echoing some value to doesn't help in the brightness as the value will differ from system to system.
First you need to set the brightness of the screen to the level comfortable to you, which can easily be done in System Settings → Brightness & Lock or by using the function keys.
Now go to /sys/class/backlight/<folder>
(my folder is intel_backlight
)
In this folder you can see the actual_brightness
file and the max_brightness
file. (If you have made any changes to the brightness after opening this file, don't forget to refresh (using Ctrl+R or F5) to see the actual current settings.)
Now we need the same value as in the brightness every time we start our system. This can be done by changing every time the value in this folder at the startup. We need to change the rc.local file.
First type these commands in the terminal (which can be opened by searching for Terminal in the dash or by pressing Ctrl+Alt+T):
sudo -i
gedit /etc/rc.local
and add the line
echo 900 > /sys/class/backlight/intel_backlight/brightness
Replace 900 with whatever value you need (that is, the value you got from the above procedure). Also replace intel_backlight
with the folder name from /sys/class/backlight/
.
For example, my /etc/rc.local:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
rfkill block bluetooth
echo 900 > /sys/class/backlight/intel_backlight/brightness
exit 0
As an aside, I added the line rfkill block bluetooth
to my rc.local file as I don't use Bluetooth at all but Ubuntu starts Bluetooth every time it reboots (even if the Bluetooth was off before). You can also add it, and just in case you want to use Bluetooth you can always start it again, even if this line is in your rc.local).
Don't change the value of exit 0
in the ending. If that line doesn't exist, add it.
Now even if you have restarted the system you will have the same value that you need.
Be careful to not put a brightness value greater than max_brightness
, as that will throw you an error saying that it is an invalid argument.

- 14,236
- 4
- 48
- 98

- 1,821
- 3
- 21
- 34
-
1Thanks dhanvi. This not only solve brightness problem but bluetooth as well. – VRR Apr 04 '15 at 13:34
-
the
rfkill block bluetooth
i have added it to the this file as i don't want to on my Bluetooth every time i started a system hope this too helped you :) – Tummala Dhanvi Apr 05 '15 at 14:05 -
1This is an excellent post. Thanks for sharing this method! I'd already used this to stop bluetooth starting up every time - and can confirm it works. – BubbleMonster Aug 20 '15 at 21:29
-
-
It isn't default. Whenever I reboot my brightness is set to 100%. Then I set the brightness with command:
$ echo 5 | sudo tee /sys/class/backlight/acpi_video0/brightness

- 481
- 3
- 15

- 39
-
3Changing the permission of
/sys
is a very bad approach as/sys
is actually a virtual FS provided by kernel itself, changing permission of/sys
has various security implications. Usesudo
to write to the file if needed.. – heemayl Aug 19 '15 at 20:43
Have you look at redshift? It's designed for another purpose (make the screen less bluish at night), but it might solve your problem as well.
To install:
sudo apt-get install redshift
My configuration file (~/.config/redshift.conf
):
[redshift]
;temp-day=5700
;temp-night=4600
brightness-day=1.0
brightness-night=0.75
gamma=0.8
adjustment-method=vidmode
location-provider=manual
[manual]
lat=63.81415
lon=20.41742
If you change brightness-day and brightness-night to a value you like and set temp-day and temp-night to the same value, you will effectively use redshift to set your brightness only.
To make redshift
autostart at login, select Applications/System tools/Preferences/Startup applications/Add. Name: redshift. Command: /usr/bin/redshift.

- 2,096
-
Not sure what you mean. redshift changes the color temperature of the screen and it may also change its brightness. – Niclas Börlin Aug 25 '15 at 05:57
-
brightness doesn't work as you think see this http://jonls.dk/redshift/ and known bugs and limitations – Tummala Dhanvi Aug 27 '15 at 06:34
-
4
Redshift has a brightness adjustment setting, but it does not work the way most people might expect. In fact it is a fake brightness adjustment obtained by manipulating the gamma ramps, which means that it does not reduce the backlight of the screen. Preferable only use it if your normal backlight adjustment is too coarse-grained.
– Tummala Dhanvi Aug 27 '15 at 06:34 -
Good idea though. Do we have similar apps that actually work. Reducing the gamma during the night or before sleeping is extremely important – nyxee Jan 09 '17 at 22:43
Once you have your preferred brightness set, you can follow the answer by N0rbert here: Brightness is reset to Maximum on every Restart. In summary:
sudo add-apt-repository ppa:nrbrtx/sysvinit-backlight
sudo apt-get update
sudo apt-get install sysvinit-backlight
sudo service sysvinit-backlight status # Show current brightness levels and values saved in files
sudo service sysvinit-backlight start # Set saved levels from files
sudo service sysvinit-backlight stop # Save current levels to files
system -> preference -> power management, on AC power -> display -> set display brightness to
– Eric Mar 12 '24 at 23:48