Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a problem with my brightness setting. When I decrease brightness to 1 and I reboot the computer, it reset to maximum brightness value. I tired to adjust it and decrease it again to 1. Why the setting doesn't save the last brightness setting for me? How can I save the current value and restore it after reboot via programming?

I also tried to add echo 0 > /sys/class/backlight/intel_backlight/brightness in /etc/rc.local file, but after rebooting, it reset to the maximum again.

My laptop model is Vaio SVF1521DCXW.

share|improve this question
up vote 2 down vote accepted

I had another folder named acpi_video0 in this location /sys/class/backlight/

I added following command at the end but before exit 0 in gksu gedit /etc/rc.local file:

 echo 0 > /sys/class/backlight/intel_backlight/brightness
 echo 0 > /sys/class/backlight/acpi_video0/brightness

It worked for me. And now I want to get current brightness and save it into a file to restore it at next restart.

How to functionality last adjusted brightness load after next reboot?

Step 1: Check brightness levels

Set your brightness to maximum and check current level by below command:

 cat /sys/class/backlight/acpi_video0/max_brightness

   (my laptop max brightness is 100 :)

Now set your brightness to minimum and check current level by evoking next command:

 cat /sys/class/backlight/acpi_video0/brightness

   (my laptop min brightness level is 0 :)

Step 2: Create a file to store your current brightness:

 sudo touch /etc/init.d/prev_brightness
 sudo chmod o+w /etc/init.d/prev_brightness

Step 3: Create a script that stores your current brightness(the save_screen_brightness file) when shutting down into the file prev_brightness that you created in the previous step:

 sudo touch /etc/init.d/save_current_brightness
 sudo chmod +x /etc/init.d/save_screen_brightness

Open the save_screen_brightness file with your favorite editor app:

 gksu gedit /etc/init.d/save_screen_brightness

And put this script into it:

 cat /sys/class/backlight/acpi_video0/brightness > /etc/init.d/prev_brightness

Save it and go to next step ;)

Step 4: Make the script run every time we shutdown or reboot the computer:

 sudo ln -s /etc/init.d/save_current_brightness /etc/rc0.d/K99save_screen_brightness
## Shuttingdown ^^
 sudo ln -s /etc/init.d/save_current_brightness /etc/rc6.d/K99save_screen_brightness
## Rebooting ^^

Step 5: Load the value we stored when starting the computer:

Add the following line at the end and before exit 0 into your /etc/rc.local file:

 cat /etc/init.d/prev_brightness > /sys/class/backlight/acpi_video0/brightness

That's it ;)

Thanks to @Hevilath's answer and @user207402's answer and also @AiPdimi's answer

share|improve this answer

On Sony Vaio E15136CN (and most others with an AMD Graphic Card), acpi_video0 is not present. Instead, there is radeon_bl0 in /sys/class/backlight. So the statement to be added to rc.local file is

echo 60 > /sys/class/backlight/radeon_bl0/brightness

Replace 60 with whatever value is suitable to you. My brightness range is 0 to 255 (you can check your maximum brightness in /sys/class/backlight/radeon_bl0/max_brightness), so 60 suits me.

None of the answers I came across mentioned the AMD Radeon Graphic Card. So I thought I might add an answer related to it. Also, Stéphane Gourichon's answer to How do I set default display brightness? doesn't work on Sony Vaio E15136CN. So in short, these are the steps to be executed:

Step 1:

sudo nano /etc/rc.local

Step 2:

echo 60 > /sys/class/backlight/radeon_bl0/brightness

Step 3:

Restart your system.

share|improve this answer

make a file like

copy all these line to it, make it executable by chmod +x and run it by this command sudo ./ restart your system.

#this script are going to get last change screen Brightness
#and put it in /.FixBritness
#this folder is in home directory that the following line make it 
mkdir $HOME/.FixBritness
cd $HOME/.FixBritness

#make two another script that put current brightness in "currntBritness" file, 
#and it must run when system is going down
cat > <<_EOF_
cat /sys/class/backlight/acpi_video0/actual_brightness > $HOME/.FixBritness/currntBritness
exit 0

#to get last brightness that saved in "currntBritness" file
#and put it in system brightness file 
cat > <<_EOF_
cat $HOME/.FixBritness/currntBritness > /sys/class/backlight/acpi_video0/brightness
exit 0

# create currntBritness file and put zero to defult value
touch currntBritness
echo 0 > currntBritness

chmod 755
chmod 755
#put in /etc/init.d/ because these file will use in /etc/rc1 through rc6
mv /etc/init.d/
mv /etc/init.d/

#make a symbolic link to that get brightness when:
#shutting down
ln -s /etc/init.d/ /etc/rc0.d/
#and restart
ln -s /etc/init.d/ /etc/rc6.d/

#symlink to put last brightness when system start.
ln -s /etc/init.d/ /etc/rc1.d/
ln -s /etc/init.d/ /etc/rc2.d/
ln -s /etc/init.d/ /etc/rc3.d/

exit 0
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.