How do you change brightness, color and sharpness from command line?

86,816

Solution 1

If the driver of your graphics card supports it, then you can use xrandr.

The following command lists the current configuration:

xrandr --current --verbose

If you want to change the configuration of an output, then you need the name of the output. This name is part of the output of xrandr --current, for example LVDS1.

The brightness can be changed like this:

xrandr --output <outputname> --brightness 0.8

Gamma (red:green:blue):

xrandr --output <outputname> --gamma 0.5:1.0:1.0

Solution 2

xrandr will not increase the screen brightness on the hardware level (the one that is changed by the laptop display brightness keys). As the xrandr manual says:

--brightness brightness

Multiply the gamma values on the crtc currently attached to the output to specified floating value. Useful for overly bright or overly dim outputs. However, this is a software only modification, if your hardware has support to actually change the brightness, you will probably prefer to use xbacklight.

Instead, use xbacklight to change the brightness:

xbacklight -get #get the current level
xbacklight -set *percent* #set brightness to a given percentage
xbacklight -inc *percent* #increase by a given percentage
xbacklight -dec *percent* #decrease by a given percentage

However, since this is same as using the laptop brightness keys, this cannot go beyond the limits of 0-100%. If you wish to brighten/darken your screen further than that limit, you can use xrandr to force software brightness levels:

xrandr --output LVDS1 --brightness 0.5

Note that xrandr accepts fractions (0.0-1.0) while xbacklight accepts percentages(0-100)

Solution 3

For laptops, I just learned from man xrandr:

   --brightness brightness
          Multiply  the gamma values on the crtc currently attached to the
          output to specified floating value. Useful for overly bright  or
          overly  dim outputs.  However, this is a software only modifica‐
          tion, if your  hardware  has  support  to  actually  change  the
          brightness, you will probably prefer to use xbacklight.

So I tried

xbacklight -get
xbacklight -set 70

and it works!

Solution 4

If you're using redshift, you need to give it your latitude and longitude so it knows when time of day changes. Something like

redshift -t 5000:5000 -l 55.7:12.6 -g .5 

Though it may be a bit unconventional use of redshift :)

Also, it works fine without sudo.

Solution 5

I use this script to set brightness on all of my displays at once:

#!/bin/bash
if [ -z $1 ]; then
    echo "Usage: brighntess BRIGHTNESS"
    echo "BRIGHTNESS is a float (0.0-1.0)"
else
    xrandr --listmonitors | grep "^ " | cut -f 6 -d' ' | \
    xargs --replace=MONITOR xrandr --output MONITOR --brightness $1
fi
Share:
86,816

Related videos on Youtube

muru
Author by

muru

Updated on September 18, 2022

Comments

  • muru
    muru over 1 year

    I am controlling my PC with SSH and scripting. How can i change the brightness, color and sharpness from command line?

    Try 1: failed

    $ sudo redshift -t 5000:5000 -g .5
    Cannot list GNOME panel applets.
    Initialization of gnome-clock failed.
    Trying next provider...
    Latitude and longitude must be set.
    

    Try 2: failed

    $ cat brightness 
    20
    $ cat max_brightness 
    20
    $ echo 1 | sudo tee /sys/class/backlight/acpi_video0/brightness 
    1
    $ echo 20 | sudo tee /sys/class/backlight/acpi_video0/brightness 
    

    Any alternative way to do?

    Follow up: http://jonls.dk/redshift/

    [command]     [1000K to 10000K]       [effects 0.1 to 10.0]
    |       |     /      /                /
    ^       ^     ^      ^                ^
    redshift  -t  1000:1000   -l 0:0  -g .1; Dark
    redshift  -t  1000:1000   -l 0.0  -g  5; Bright
    
    • Lekensteyn
      Lekensteyn over 12 years
      See askubuntu.com/questions/57236/… for changing the brightness
    • Admin
      Admin over 12 years
      @Lekensteyn: please see the posted comment. Did not worked i am uing 11.04 and tried echo 0 to 20 remains same.
    • Dzamo Norton
      Dzamo Norton almost 5 years
      Note that applying gamma correction (-g argument to redshift) is not the same effect as adjusting the brightness (-b)
  • deepak
    deepak over 12 years
    +1 that really did a small trick. But really i am looking for same way more RAW brightness + color + gamma tuning.
  • landroni
    landroni about 10 years
    In my case, the xrandr --output eDP1 --brightness 0.2 approach works fine while xbacklight -set 20 fails.
  • nwgat
    nwgat about 10 years
    this works, FYI: newer laptops use eDP
  • user643605
    user643605 over 9 years
    I found I didn't need to use the verbose option.
  • hydroxide
    hydroxide over 7 years
    It would be helpful to see an example of output for "xrandr --output <outputname> --brightness 0.8"
  • WinEunuuchs2Unix
    WinEunuuchs2Unix over 6 years
    accepts fractions (0.0-1.0) is misleading. For my external TB3 DisplayPort to HDMI this worked fine: xrandr --output DP-1-1 --brightness 1.2
  • Wil
    Wil about 5 years
    @WinEunuuchs2Unix Yes, setting it >1.0 crops the display gamut in exchange for overall brightness increase. In other words you lose details in bright areas.
  • Sigur
    Sigur over 4 years
    Is this related to the temperature of the monitor? I mean, with xrandr darker should it be colder than using some other tool? I'm afraid that my monitor is too warm.
  • Philip Rego
    Philip Rego over 4 years
    doesn't change brightness for me.
  • Philip Rego
    Philip Rego over 4 years
    Does nothing. Doesnt change brightness
  • Philip Rego
    Philip Rego over 4 years
    No monitor supporting DDC/CI available.
  • Philip Rego
    Philip Rego over 4 years
    xrandr isnt working
  • user334639
    user334639 over 4 years
    This post is from 2013. I can't make it work with my current laptop either....
  • Reinier Post
    Reinier Post about 4 years
    for me neither.
  • BadmintonCat
    BadmintonCat over 3 years
    @sigur temp colour is relative weighting of red / blue curves, --gamma can be used to tweak it a bit. I think you'd need to poke at the LUT to get finer tuning if the monitor has no settings you can use.
  • Frank Nocke
    Frank Nocke over 3 years
    This has brightness and gamma, is there also such thing as white balance / color temperature ?
  • F. Hauri
    F. Hauri over 2 years
    See xrandr --output $(xrandr --listmonitors | sed -ne 's/ .* //gp') --brightness $1