[How To] Adjust the brightness of a laptop in Linux

laptop

Hello colleagues, yesterday I installed Kubuntu 13.04 on my laptop and the brightness did not work for me, like other distributions with kernel higher than 3.5.

As always, I searched the internet for a solution, but none of them worked, although they did give me an idea of ​​what the solution would be.

So, here is how to solve it:

First

We open a terminal and write the following:

ls / sys / class / backlight /

Here several folders will appear (they are really symbolic links), in my case 2:

acpi_video0 intel_backlight

Within each of them there are several files, but the ones that interest us is brightness and max_brightness

We will then have:
/ sys / class / backlight / acpi_video0 / brightness
/ sys / class / backlight / acpi_video0 / max_brightness
/ sys / class / backlight / intel_backlight / max_brightness
/ sys / class / backlight / intel_backlight / brightness

brightness: Indicates the current value of brightness
max_brightness: Indicates the maximum value that the brightness can have

My acpi_video0 values ​​are from 0 to 99
My intel_backlight values ​​are from 0 to 4882
Second

Now we check which of the two files is the one that modifies the brightness:

For this, in a terminal with root permissions or using sudo:

Attention! We are going to modify the brightness value, so do not put 0, because you will not see anything. I recommend putting half of the maximum value.
Example:

If the maximum is 99, we put 50
If the maximum is 5000, we put 2500

echo 2500> / sys / class / backlight / intel_backlight / brightness

If modifying that file does not modify the brightness, we try the other one:

echo 50> / sys / class / backlight / acpi_video0 / brightness

One of the two or the ones you have should change the brightness of your screen.
Third

Once we have identified the file that modifies the brightness, we are going to create two scripts, one to increase the brightness and the other to lower it:

Raise the brightness:

#! / bin / bash
brightness = $ (cat / sys / class / backlight / intel_backlight / brightness)
brightness = $ (expr $ brightness + 300)
echo $ brightness> / sys / class / backlight / intel_backlight / brightness

We save it as SubirBrillo.sh

Lower the brightness:

#! / bin / bash
brightness = $ (cat / sys / class / backlight / intel_backlight / brightness)
brightness = $ (expr $ brightness - 300)
echo $ brightness> / sys / class / backlight / intel_backlight / brightness

We save it as BajarBrillo.sh

** Remember to change both the value to add or subtract and the file address to your proper file.

Once we have the scripts, we give them execution permissions:

chmod + x Brightness Down.sh Brightness Up.sh

Fourth

Now we are going to give permissions to the brightness file so that the scripts can modify its value.

To do this we open the /etc/rc.local file with root or sudo permissions

nano /etc/rc.local

Once open, we add the following line just before the exit0 line:

chmod 777 / sys / class / backlight / intel_backlight / brightness

And we save the changes.
Quinto

Now we can run the scripts to raise and lower the brightness without any restrictions.

But of course, you are not going to start running scripts every time you want to raise or lower the brightness, so I recommend that you configure keyboard shortcuts to be able to change the brightness quickly.

YOUR BRIGHTNESS SHOULD ALREADY CHANGE PERFECTLY

And this is it, I hope this guide will help someone.

Greetings and thank you.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   invisible15 said

    I fixed that problem on a Fedora 17 laptop by tapping the kernel line in grub and adding this:
    acpi_backlight = vendor
    On the internet I saw that some were doing and others were not, but in my case it worked (Acer Aspire 5742)
    Until now I used a method similar to the one in the post.

    1.    likewho said

      The same I did on Arch Linux.

    2.    likewho said

      And by the way, I also have the same XD laptop

    3.    luigi giovani said

      as I enter the kernel line in the grub and add this:
      acpi_backlight = vendor,

      I hope they help me thanks.

      1.    chexmo said

        I use grub customizer

  2.   Edit Sueiras said

    And I, on my Linux Mint 14, I just open the Guake terminal with the F12 key and type xgamma -gamma 0.6 (change the number to 0.7, 0.8 or lower depending on your preference). Simple!

    1.    Bertoldo said

      Hello, xgamma command works for me, but when decreasing it still leaves shiny objects.
      I installed xbacklight command, but it can't run.
      LinuMint 17.3, MSI mobo PC with video onboard Amd radeon 3000.
      I have not tried the rest.

  3.   Christian said

    Everything worked perfect, thanks for sharing it, I had that problem of brightness for a long time my laptop when it was without power and I did not know how to increase the brightness.

    Greetings.

  4.   just-another-dl-user said

    the bright. the problem that has given me the most headaches in linux.
    after about a year of battles I was able to get it to work on Ubuntu 10.04 and Archlinux. there is no case that it works for me in other distros.
    ps: i have a samsung R430

  5.   Miguel-Palacio said

    Pretty useful information. Thank you.

    I did not really know that there were such recurring problems in the Linux world with this brightness, until this week when I got a Dell XPS 13. Fortunately, using the patched kernel from the Sputnik project, the problems were solved. I read that Ubuntu 13.04 already came with the default patches, but the brightness setting didn't work for me on the live CD, so I stayed on 12.04.

    In case anyone has problems, I recommend that you take a look at the Sputnik project, maybe those patches will help.

    1.    Miguel-Palacio said

      How weird, my user-agent should be Kubuntu ¬_¬

      1.    pandev92 said

        If you have not changed it, it will always show ubuntu, since kubuntu is nothing more than ubuntu with kde ...

        1.    Windousian said

          If Ubuntu comes out with Firefox it is because Kubuntu uses the Firefox installer that Ubuntu has. That "it's just ubuntu with kde" is wrong. It's like saying that Ubuntu is nothing more than Debian with Unity.

        2.    Miguel-Palacio said

          No, I am 90% who previously appeared: P. I think the problem is that I did not use the Firefox installer that Kubuntu brings, but apt-get install….

    2.    just-another-dl-user said

      @ Miguel-Palacio, can the patched Sputnik kernel be installed in Archlinux on a Samsung notebook? Or is it only for Dell XPS 13 with Ubuntu?

      1.    Percaff_TI99 said

        Hello @ just-another-dl-user I have tried it in Linux mint and it works but it changes the screen resolution and the mouse does not work, the touchpad does, something similar to what happens at least in my case deactivating acpi = off . I prefer to use acpi_osi = Linux although it bothers me to have to press fn + left. It is the bug that must have been unresolved the longest. I use emachines e725 i915 intel.

        Here in the link it says that it can work on other laptops with intel graphics.

        https://launchpad.net/~canonical-hwe-team/+archive/sputnik-kernel

        I hope it works for you.

        Regards!!!

      2.    Miguel-Palacio said

        In the guide I used (http://www.webupd8.org/2012/08/fix-dell-xps-13-backlight-brightness.html), they say this:

        For Arch Linux users, WebUpd8 reader dcelasun has created a custom kernel that uses these patches: https://aur.archlinux.org/packages.php?ID=60736

        I hope you serve, greetings!

      3.    Miguel-Palacio said

        No, sorry, I did not read correctly, apparently it is only for the XPS 13. Perhaps the solution given in this link will help you:

        http://www.techjail.net/solved-brightness-problem-in-ubuntu-12-04-precise-pangolin.html

        Apparently for some it works well, in my case, the brightness level felt comfortable but the commands did not work for me: - /

  6.   rots87 said

    I in archlinux and with a graphics card nvidia 560m corrected it using this part of the wiki https://wiki.archlinux.org/index.php/NVIDIA_%28Espa%C3%B1ol%29#Activar_el_control_del_brillo

  7.   stebson said

    On my lap the brightness buttons worked perfectly in kubuntu 12.10 but with the update to 13.04 those keys are dead although I can not change the brightness nor in the power menu I have a dell 15r computer I will see if this solves it for me although that update for me brought some improvements so far the only bad thing has been the brightness

  8.   nosferatuxx said

    Well, I have not had this problem with hp-compaq 6220 and 6910p laptops.

  9.   eliotime3000 said

    Good that setup. Now, I just hope that with Debian Wheezy looming soon I won't have to reach out to change the brightness of my laptop.

  10.   merlin the debianite said

    If you use KDE you shouldn't have that problem XD.

  11.   Lea said

    Hello! I tried the script, but when I want to run it, either one, it tells me "expr: syntax error
    ./DownBright.sh: line 4: echo: write error: Invalid argument »
    The same with the other, what will it be?

    1.    Victor_ora said

      Did you do all the steps? Surely the brightness file will not have the necessary permissions, you have not done all the steps correctly.

      1.    Lea said

        Yes Yes! Look at rc.local, it was like that.

        #! / 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.

        chmod 777 / sys / class / backlight / cmpc_bl / brightness
        exit 0
        «

        1.    Victor_ora said

          Execute the command with administrator permissions in a terminal:

          chmod 777 / sys / class / backlight / cmpc_bl / brightness

          and then run the scripts.

          It shouldn't give you trouble.

          1.    Victor_ora said

            I think I know what it is.

            Tell me the value of the file:

            / sys / class / backlight / cmpc_bl / max_brightness

          2.    Lea said

            I tried and it tells me the same: s

            The value of max_brightness is 7

        2.    Victor_ora said

          Modify the two scripts and change the value 300 to 1.
          They would look like this:

          Increase Brightness:

          #! / bin / bash
          brightness = $ (cat / sys / class / backlight / intel_backlight / brightness)
          brightness = $ (expr $ brightness + 1)
          echo $ brightness> / sys / class / backlight / intel_backlight / brightness

          Lower Brightness:

          #! / bin / bash
          brightness = $ (cat / sys / class / backlight / intel_backlight / brightness)
          brightness = $ (expr $ brightness - 1)
          echo $ brightness> / sys / class / backlight / intel_backlight / brightness

          1.    Lea said

            I tried, and it tells me the same ...
            It looks like this

            #! / bin / bash
            brightness = $ (cat / sys / class / backlight / cmpc_bl / brightness)
            brightness = $ (expr $ brightness - 1)
            echo $ brightness> / sys / class / backlight / cmpc_bl / brightness

          2.    Victor_ora said

            Put this command directly:

            echo 1> / sys / class / backlight / cmpc_bl / brightness

            Then,

            echo 3> / sys / class / backlight / cmpc_bl / brightness

            Does the brightness change you?

          3.    mrmanu said

            How about friend, I give you my congratulations and thank you for giving light on this issue, which is affecting me a lot, since I always start my linux mint 13 matte, with the maximum brightness. I explain what I try to do:
            What I want to do is that from rc.local I execute a script at the end of the boot so that it modifies the value of brightness in a default value, and that leaves it fixed forever.
            In rc.local, I have put the following:
            #! / Bin / sh
            #
            # rc.local
            #
            chmod 777 / sys / class / backlight / intel_backlight / brightness
            chmod -x /home/usuario/DownBright.sh
            sh /home/user/BrightnessDown.sh

            exit 0

            then I have created the script «LowerBrightness.sh», and I have given the execution permission, and I have hosted it in /home/user/BajarBrillo.sh and its content is like what you put in the post:
            #! / bin / bash
            brightness = $ (cat / sys / class / backlight / intel_backlight / brightness)
            brightness = $ (expr $ brightness - 3500)
            echo $ brightness> / sys / class / backlight / intel_backlight / brightness

            Indeed, the brigtness file range is between 0 and 4882.

            Well with all this, I can not lower the brightness to leave it by default.

            Please, could you correct me, I am doing wrong, it is something very important, since I cannot work in linux like that, it destroys my eyesight.
            Kind regards.
            Manu

      2.    DNT said

        The same thing happened to me, in my case the problem was that since I copied and pasted from here, I copied it with formatting, and I didn't take the subtraction symbol well, so it was just a silly syntax error, it almost made me throw the machine through the window hahahaha

    2.    DNT said

      The same thing happened to me, in my case the problem was that since I copied and pasted from here, I copied it with formatting, and I didn't take the subtraction symbol well, so it was just a silly syntax error, it almost made me throw the machine through the window hahahaha

  12.   Oscar said

    It happens to me that I cannot lower the brightness from the indicator or with the function keys, Inspiron 15R. Although this can be done, it is certainly somewhat tedious, as it needs to be adjusted quickly and easily. Still, thanks for the tutorial.

    1.    Victor_ora said

      If you read the whole tutorial, you will see that at the end it says that you can assign the execution of the scripts to the combination of keys that you want and with KDE it is very easy.

      In fact I also have a Dell Inspiron 15r from 2013 and the keys:

      Fn + F4 -> Lower the brightness
      Fn + F5 -> Increase the brightness

      Exactly the same as series combinations.

      You just have to find out how to make keyboard shortcuts on your desktop, be it KDE, Gnome, Xfce or others.

      1.    Oscar said

        Yes, I saw it. Certainly I would like it not to have that error and make everything automatic, but no way.

    2.    George said

      Hello

      I have a DELL 15R Inspirion 5521, with Intel / AMD 8300 series graphics. I had the same problem, the fn + F4 / fn + F5 keys did not work. It should be added that I use ubuntu 12.04.5 with a kernel higher than 3.13. I found the request on the web following: https://wiki.archlinux.org/index.php/backlight

      The only thing I did was add: »video.use_native_backlight = 1« in the grub (skip the quotes)
      My grub looked like this:
      GRUB_CMDLINE_LINUX_DEFAULT = »elevator = noop video.use_native_backlight = 1»
      With them solve the problem.

      In my case the file is the intel: / sys / class / backlight / intel_backlight /

      I hope those who have a DELL will help

  13.   Lea said

    I just tried the commands like you told me, and yes they work,
    but the script keeps telling me the same thing, what will it be?

  14.   Wada said

    Hahaha I'm a simple man 😛 that's why just assign xbacklight by pressing fn + brightness
    xbacklight-inc 10%
    xbacklight -dec 10%
    I never liked doing all that to just raise or lower the brightness apart I always use it at 20% hahaha 😀

  15.   Alberto said

    It's driving me crazy, I had to leave mageia, Rosa linux and Mint for the brightness, now I have lubuntu and I will move to Sabayon ,,,, I have a hp pavilion g4-1063la, some time ago I read that it was something related to the kernel ,, , doing a few installation steps with the backlight it worked in mint 14 nadya ,, but when returning to that distro it no longer works ,, I'm about to give up, I don't know what the hell to do ,,,,,,, by the way about the gamma that mentioned above it works but it is not the same as lowering the brightness with the f2 and f3 keys ..... greetings to all very good site.

  16.   Miguel said

    I congratulate and thank the author of this magnificent contribution; 1 year, testing multiple "solutions" in lubuntu, always very complex and always ineffective: disappointing; and the brightness is 100%, hurtful, consuming, generating heat, etc. The author's key is in the system exploration in this regard, with the command ls / sys / class / backlight /. In my case, I have lowered from 100 in which it was fixed, to 10, which looks good, it heats up less than with winxp, The battery lasts longer and it does not harm my sight. Now I will face the scripts and shortcuts, which I do not understand yet. Thank you.

  17.   Miguel said

    Abusing you, how do I create scripts and shortcuts ?; thanks in advance.

  18.   Raul said

    Hello !, I have followed all the steps, the scripts work perfect executed in console, but when creating the shortcuts it worked at the beginning, but when restarting they have stopped working, I have recreated them but nothing, I have to use the terminal every time I want to raise or lower the brightness, does anyone know how to solve it?

  19.   I gave said

    more handmade but not always for laptop

    find your way out with xrandr

    xrandr
    Screen 0: minimum 320 x 200, current 1280 x 800, maximum 4096 x 4096
    VGA1 connected 1280 × 800 + 0 + 0 (normal left inverted right x axis y axis) 0mm x 0mm
    1024 × 768 60.0
    800 × 600 60.3 56.2
    848 × 480 60.0
    640 × 480 59.9

    in my case it came out VGA1 it can be HDMI1 or VGI1 maybe default

    now find the intensity with the command and the output xrandr –output –brightness 0.8

    for example for me a value of 0.8 or 0.7 or 0.9 or 0.6 etc etc

    xrandr --output VGA1 --brightness 0.8

    now once we have the desired intensity we are going to tell it to start whenever xorg starts at that brightness by sending the command to a file (called brightness) in the xorg server session

    sudo echo "xrandr –output VGA1 –brightness 0.8" >> /etc/X11/Xsession.d/brillo

  20.   Israel said

    Thanks friend! the command worked for me

    echo 2500> / sys / class / backlight / intel_backlight / brightness

    I had been trying to solve it for over a year and finally I succeeded haha ​​thanks!

  21.   Gabriel said

    Your Excellency friend, this topic served me wonderfully, it is appreciated that you share your knowledge, like you, I suffered from the intense brightness of my lap when I started in Linux, without knowing how to download it, but here I solved my problem. Now I can raise and lower the brightness to my liking and need.

  22.   happy jose said

    Thank you very, very much.
    I tried many ways and I could never get the brightness down and my eyes hurt from reading so bright ..

    100% dejected ..

  23.   Miguel said

    Hi, thanks for the post.
    Funny thing: it works for me to raise the brightness, but not to lower it !!!
    if I run the script to lower the brightness it returns this message:
    "Expr: syntax error"
    I have repeated all the steps and repeated scripts with different names.
    In the end, a bit dirty, I have made a script to leave the brightness very low and another to increase it, it is already a very big advance !!! Thanks a lot!!!
    (by the way, first time I use scripts)

  24.   jesusobac said

    hey thanks friend !!!
    check your solution, but I have a question, with that I can adjust the brightness with the keyboard ?, I say, because that is what I want to do.
    Thank you

  25.   Delsy Lopez said

    Thanks a lot! They are great! 🙂

  26.   joakoej said

    You are a genius, you do know about the system, thank you very much for the tutorial.
    By the way, where did you learn this? Did you take a course or is it on the internet?

  27.   Javi said

    Thank you so much for this information. In my case, I could adjust the brightness, but in the last position (the brightest), the screen instead of shining fully, it was turned off.
    In debian jessie, based on what is explained here, I have solved it by matching the value of: / sys / class / backlight / intel_backlight / brightness
    (which was slightly lower) with that of:
    / sys / class / backlight / intel_backlight / max_brightness
    In case it serves to someone. Regards.

  28.   Tobias said

    Very Good the post! It served me a lot since my ubuntu 14.04 does not work so well with my vaio: S.
    I have only one problem, the scripting commands work fine and I see that it is well typed but when I run the .sh it tells me "expr: syntax error". Any idea what could it be? Cheers

  29.   chrisfer said

    my backlight directory is empty 🙁 what do I do with that ?! and why is it empty

  30.   Enrique said

    THANKS friend, you don't know how much your post helped me, I have arch installed and the screen was flickering and had a dimmer brightness in my case, the one that controlled it was the one on the motherboard, it had 11 out of 15, so I started looking for a driver by putting parameters in grub at the beginning and nothing until I light up your post

  31.   Vir said

    Instead of acpi_video0 I get sony, well I have a vaio, what should I do

  32.   Oliver Portuguese said

    Perfect, it worked wonders for me, I was already getting a headache at night. It seems cumbersome but for those who care it does not represent much of a problem. [Acer Aspire v5-131]

  33.   Karl Wünsch said

    It served me !!! Thank you very much I was able to do it on my laptop 😀

  34.   shamaru said

    excellent friend works to perfect.
    Tested at Crunchbang / Waldorf 11.

  35.   Diego Rivera said

    This solution is more radical and seems to me to be definitive.

    http://lucasromerodb.blogspot.com.ar/2013/06/ajuste-de-brillo-en-ubuntu-no-funciona.html

  36.   Fredy hidalgo said

    Excellent tutorial… although I haven't tried it, thank you for taking the time to share your knowledge. Hopefully it works for me, although what I'm trying to do is modify the lowering range every time you raise or lower the brightness from the keyboard, but with your tutorial you already give me an idea of ​​more or less where to start. Thank you and God bless you.

  37.   Bryan said

    Hello, I am urged that someone could help me to undo this procedure, specifically delete the backlight_d.sh file since it damaged my kubuntu, now I can only open one window at a time, the minimize, maximize and close buttons disappeared and sometimes I cannot to write.

    1.    Luciano Donato said

      Thank you very much for the tutorial, it is quite a simple and elegant solution.
      A few years ago I had this problem with the screen and there was no case, I gave up trying so many alternatives, I couldn't. Thanks a lot!

  38.   Kike said

    Hola!

    I can think of a medium script in a hurry that does both (raise or lower the brightness depending on a parameter)

    On the other hand, I do not recommend chmod 777, but simply run the script as root or as sudoer.

    I hope it is useful

    #! / bin / bash

    if [$ # = 0]; then
    echo «You must pass at least one parameter (- or + i possibly the number by which the brightness increases or decreases ...»
    exit
    fi

    BR = $ (cat / sys / class / backlight / intel_backlight / brightness)

    if [$ # = 2]; then
    VAL = $ 2;
    else
    VAL = 25; #Value by which I want to increase or decrease the brightness each time the script is executed
    fi

    MIN = 1; #Minimum value that I tolerate for brightness (to avoid, for example, that it reaches 0 or negative
    MAX = 1000; # The same as the minimum but backwards 😉

    echo "Current brightness:" $ BR
    if [$ 1 = "-"]; then
    BR = $ (expr $ BR - $ VAL);
    if [$ BR -gt $ MIN]
    then
    echo $ BR> / sys / class / backlight / intel_backlight / brightness;
    echo "New brightness value:" $ BR;
    else "You cannot lower the brightness below $ MIN";
    fi
    elif [$ 1 = "+"]; then
    BR = $ (expr $ BR + $ VAL);
    if [$ BR -lt 1000]
    then
    echo $ BR> / sys / class / backlight / intel_backlight / brightness;
    echo "New brightness value:" $ BR;
    else "You cannot raise the brightness higher than $ MAX";
    fi
    else
    echo «Valid parameters are + and -«;
    fi

  39.   margarita said

    Thank you !!! it helped me

  40.   FLAVIO said

    Congratulations friend, it helped me a lot in wifislax

  41.   efuey said

    It works for me as follows:
    xgamma -gamma 0.300
    regards

  42.   Jose Poblete said

    thank you thank you ... it helped me a lot ...
    I finally found the option for when the xbacklight does not work ..

  43.   Pacman said

    Thank you!
    I have installed debian on a sony vaio all in one model VGP-WKB5 and although I have not managed to make the fn key work, I can finally raise and lower the brightness from the keyboard with the F5 and F6 keys.
    I put here how my scripts would be in case they serve someone else who has this pc:

    upbrillo.sh
    #! / bin / bash
    brightness = $ (cat / sys / class / backlight / nv_backlight / brightness)
    brightness = $ (expr $ brightness + 3)
    echo $ brightness> / sys / class / backlight / nv_backlight / brightness

    lowerbrillo.sh
    #! / bin / bash
    brightness = $ (cat / sys / class / backlight / nv_backlight / brightness)
    brightness = $ (expr $ brightness - 3)
    echo $ brightness> / sys / class / backlight / nv_backlight / brightness

  44.   fabian said

    interesting that nobody told you yet that the commands in Linux must be entered in lowercase, but also, good for the post. thanks

  45.   Gilabert said

    It has worked like a charm. It seems incredible that with Ubuntu 20.10 that will still happen.
    Thank you.

  46.   Jose Gustavo said

    property

  47.   ramsi said

    Thank you very much Brother you have saved me

  48.   Zeid said

    Bro I don't know how to thank you, but my fried egg eyes are no longer going to be fried and it's all thanks to you. thanks a lot. I LOVE YOU

  49.   Thomas AJ said

    Well, nothing boy, everything is rubbish, something that works stops working on its own, without any explanation, the good part of him, apart from the help that has not helped me, is that at least he has not written as a watermark , that one can go blind without any need, I leave them with computers all my life, because with them there are no experts, one believes that they know and surprise, you don't know anything, total incompetence, of course I am not referring to you, but what they call development, good friend, thanks for your help.