How to adjust screen brightness in Ubuntu 14.04?
Manually changing brightness
Remember that on Linux/Unix everything is a file. Brightness value is also stored in a file. Open a command line ( aka Terminal) by pressing Ctrl+Alt+T, or by searching 'terminal' application in the dash. Then execute these commands:cd /sys/class/backlight/
. cd is basically used for navigating through directories. And under backlight for me there is folder acpi_video0, but for you it may be different. Use ls
command to find out what folder name it is. cd to that folder as well. So for example, I would do as show in picture
OK, so by now you have navigated to the folder which contains your brightness settings. Inside there is brightness
file and max_brightness
file.
cat max_brightness
will tell you the maximum brightness that you can set on the screen. brightness is the actual file that controls brightness. You can change it from 0 to whatever number is in max_brightness.
See the number 7 after I did cat max_brightness
? This is my maximum brightness value, so it means i can change brightness from 0 to 7.
Now we can edit brightness file to actually change screen brightness. We will need some text editor command. I prefer using command line text editor nano. So I would do
sudo nano brightness
It will ask you for your password. Enter it, and you will see a screen something like this:
Do you see where is my cursor? right after the number. That's what i mean when i said, don't hit enter. This file has to have only that one line, no other. You can use left/right keys to move cursor, and backspace or del keys to delete old number, and then type new. Remember, that you can only go from whatever number was in max_brightness file to 0.
When you wrote new number, press Ctrl+X, it will ask if you want to "Save modified buffer". Press Y. Then it will asks what name of the file to write. Just press enter, we do not want to change name of this file. Done. At this point your brightness should change.
Small note on the side: The problem with graphic text editor like gedit, is that it tries to create a backup for every file, and brightness file and that folder has permissions such that only root can modify it, so it won't let gedit to change that file or create backup, even with gksudo - i tried
Script version: This script opens my brightness file with nano editor. Make necessary adjustments for your system, as some folder names may be different.
#!/bin/mksh
printf " \n Entering file to change brightness in 3 seconds\n remember - no new line after number. ";
sleep 3;
sudo nano /sys/class/backlight/acpi_video0/brightness
Try the utility xbacklight
.
What worked for me was:
sudo apt-get install -y xbacklight
xbacklight -set 50 # Set display backlight to 50%
xbacklight -set 100 # Set display backlight to 100%
xbacklight -inc 10 # Increase display backlight by 10%
xbacklight -dec 10 # Decrease display backlight by 10%
Confirmed to work on:
- Ubuntu 15.10 + ASUS machine
- Ubuntu 16.04 + MacBook Air
Extending @Serg's answer.
Navigate to the directory containing
brightness
, e.g./sys/class/backlight/intel_backlight
Use
sudo chmod 770
to change file permissions Note: there is some security risk associated with making this file less restricted.Use
sudo chown user_name brightness
whereuser_name
is your user name. Thewhoami
command will tell you your user name if you aren't certain. Note: there is some security risk associated with making this file less restricted.cd ~/bin
. If it [1] does not exist, firstmkdir ~/bin
.-
Create a script file named "brightness" from the command line.
$> touch brightness $> chmod 777 brightness
-
Edit
brightness
with your favorite editor to:#!/bin/bash echo "$1" > /sys/class/backlight/intel_backlight/brightness
-
From the command line:
sudo ~/bin/brightness 1000
will set the brightness to 1000. Note: the appropriate settings for your machine may be different. Be sure to verify the max_brightness as mentioned above.
- Adding
~\bin\
to the path reduces the command tobrightness <n>
wheren
is the desired level of brightness.
[1] Or it's equivalent
I am unsure about the changes that you are doing to grub and trying to install xbacklight.
But there are some good guides out there. An article from itsfoss worked for me.
Before you try out the article, open up terminal and key in acpi_listen
and then press your fn+up
and fn+down
key combinations to check whether your brightness keys are actually getting registered by Ubuntu or not.
I think this one is the easiest of all the solutions, and it provides you with a graphical icon to control brightness:
sudo add-apt-repository ppa:indicator-brightness/ppa
sudo apt-get update && sudo apt-get install indicator-brightness
Reference: Add Brightness Control to Ubuntu Desktop With This Handy App