rc.local Is a script that by default does nothing and is executed last of all the startup scripts. Our plan is to edit this script to lower the screen brightness.
Step 1All of my scripts are on Github:
$git clone https://github.com/kd8bny/randoScripts.git
The first thing to do is figure out what brightness value works for you. So in order to accomplish this set your display using your function keys or under Brightness & Lock in your settings menu.
Once you have found the desired setting run this command:
IMPORTANT:If you finish this tutorial and it didnt work for you, you may need to use
Anyway, the cat command should spit out a number. The number varies depending on your display. Mine happened to be 34 so I will use that in my examples.
If you would like to practice with values via terminal before settling use this:
$echo VALUE | tee /sys/class/backlight/acpi_video0/brightnessWhere VALUE is the number you want to use.
Step 2Go ahead and open up the rc.local file and place the value you want in the location of VALUE_HERE. The script should now look like this:
#!/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. sleep 1 echo 34 > /sys/class/backlight/acpi_video0/brightness exit 0
The sleep is somewhat important in this case by waiting until the OS is completely loaded before changing the values.
Step 3Next move the script into the proper location if you didn’t edit your own.
$sudo mv rc.local /etcAnd to enable it we have to make it executable
$sudo chmod +x /etc/rc.local
Fini!After a reboot you should now see that your screen will start at your desired value. I am considering editing the script to remember the last screen value. Not sure if its worth it.
Question??I would really like to keep this repo going with many useful scripts. They show the real power of the Linux OS and your control over it.
Would an automated installer be a nice feature to have? Giving the user choices of scripts they may like to have.
Let me know in the comments.
**The customary for those who care
Ubuntu 14.04, rc.local