Change Screen Brightness From Terminal (Ubuntu 10.04)

11 05 2010

If you want to change the screen brightness in Ubuntu (I can’t change it using the keyboard shortcuts or the Ubuntu Power Management menu), open a terminal and execute the following:

sudo setpci -s 00:02.0 F4.B=xx

Where xx is the desired brightness in hex ranging from 0 (brightest) to FF (no brightness at all). I usually change it to E0 when working on battery.

Cheers!


Actions

Information

51 responses

27 05 2010
Joe

THx – looks much better now.

29 05 2010
Tadas

It gives me such an answer, what should I do?
setpci: Warning: No devices selected for `F4.B=E0′.

30 05 2010
wilmor24

Are you trying to do this on a desktop? I have only tested this on laptops and I believe it is different for desktops. Alternatively, you could use xgamma to change the brightness:

xgamma -gamma .75

Let me know if it works.

1 04 2012
Sunil

This reduces the brightness by 25 percent.
Thank u..

31 05 2010
Tadas

I’m using laptop, HP ProBook 4510s

But the xgamma thing helped me! Thanks!

31 05 2010
Tadas

But still, the white color is super bright compared to others while using xgamma, of course it’s logical… so it doesn’t solve the problem with real brightness

7 06 2010
wilmor24

Sorry it took me so long to reply. The problem you are having is that you are not selecting the right device (meaning, 00:02.0 is not your VGA controller). First, see the list of the devices installed on your machine with lspci
In my case, I get:
00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 09)
Hence I execute the command with 00:02.0 as my device. So make sure you are pointing to the right device and then execute: sudo setpci -s xx:xx.xx F4.B=xx
Try it out and let me know how it goes.

15 06 2010
Hakan

The advice worked very well, and solved a big problem.
Many thanks !!!

26 08 2010
Is

It worked on my Lenovo B450. Thanks to the writer of this post!!

7 11 2011
Maqic Xu

me, too.
thank you.

12 09 2010
Jim

This worked for me.
Short note though, 0 is hexadecimal for completely black, so when i tried that at first, my screen went dark. Then I tried FF (which means white) instead, and got 100% backlight! So your explanations of those numbers are really opposite!

But at least this command solved my problem, thank you so much! :)

20 02 2011
wilmor24

Well, on my system it works as I explained it, but it could always change from one environment to another. Thanks for pointing it out, though!

13 10 2010
Jessid

Hello. I had the same problem with my toshiba laptop, but solved it with your advice. I would like to ask you something… how did you know the F4.B numbers did the magic????? where can a list be found? what other type of problems could be solved with the setpci????

thanks a lot!

21 12 2010
Ceko

Hello sudo setpci -s 00:02.0 F4.B=xx with this comand i can control my intesity but 0 is to big =A1 still to bright whats next ? or what;s the list for 0 to FF A1 still to bright

26 12 2010
Isak

I belive the darkest setting possible is 01 – not using any letters, just numbers.

Worked on my Acer Aspire One!
Many thanks!!

12 02 2011
wilmor24

I’m not sure if it changes from distro to distro, but on my computer 00 is the brightest and FF is the darkest.

28 01 2011
Ceko

After i set my brightness when i restart its’ back to normal is there any thing to keep it this way without having to go to terminal and type again and again ?

12 02 2011
wilmor24

You could add it as part of your user’s login script to make it permanent.

28 06 2011
Artur

How do you do that?

11 02 2011
Thomas

Lifesaver. Now I ask myself, why wasn’t this on the first website I looked, but buried under unanswered threads?

20 02 2011
skywalker_7421

Thanks. Knew the command. Didn’t know what it did

3 03 2011
Mohammed Jabir

Thanksss.
It worked on my toshoba laptop..

10 03 2011
Ubuntu 命令行调节屏幕亮度 | Felix's Blog

[...] 直到某次重启发觉引导界面很亮- – 各种Google之后找到一篇blog及其评论里比较详细的介绍了两种命令行调节屏幕亮度的方法 [...]

29 04 2011
lbx

thanks! it works for me
…just install ubuntu 11.04, it started dimly, no brightness at all, f…; no problem with all previous versions.

2 06 2011
Matt

I have a HP Pavilion Laptop and tried every command here but continue getting errors. It either says “invalid value” “bash: syntax error near unexpected token ‘newline’” or it acts as if I didn’t enter a command and erases the line. Any ideas?

14 06 2011
dillep

screen brightness problem during the installation of ubuntu 11.04 on ACER laptop .
if any solution plz suggest ,Fn +key not work.

14 06 2011
dillep

screen brightness problem during the installation of ubuntu 11.04 on ACER 4735
laptop 3RAm ,core2due 2.2Ghz.
if any solution plz suggest ,Fn +key not work.

17 06 2011
Nishanth

I’m running an Ubuntu 11.04 from command line .. haven’t installed X yet .. Worked like a charm

1 07 2011
open

could someone put together a script which could be wired to Fn+ arrow keys?
So far this is the onlz soultion that worked for me, great.

4 07 2011
nhojra

hey! can you give me a list of possible code such as middle brightness? brightest? darkest? what codes are available in setting brightness? E0 is good! thanks

19 07 2011
Gerard Gerry Caulfield

Counting in hex is like this: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1a, 1b, 1c, 1d, 1e, 1f, 20

Basically this just means for every place you have 16 numbers instead of 10.

So instead of counting from 0-9 you count from 0-f

29 07 2011
duniacyber09yuda

thanks a lot!
awesome article ;)

29 07 2011
Peter

xgamma can be improved to produce almost full backlight by replacing .75 with .99 so:
xgamma -gamma .99
although thanks so much, this has helped enourmously :D

4 09 2011
D

I have same problem with my vaio vpccw17fx ! I found the code for my VGA Nvidea but still this command doesn’t work :( does any one know why it is like this? how can I reduce the brightness?
Thanks.

19 09 2011
Sven

Nice one! Works on my Samsung X520, too!
Thanks!

21 09 2011
YMSt

i’m using compaq presario cq35 ubuntu 11.04.
this adjusted my screen / display brightness.

thank you very much!

25 09 2011
Ishan Somasiri

Well, this solution did not work in my laptop. (Ubuntu 11.04 on Dell Inspiron 1464).

What I wanted to do was to set the display brightness to a value that I need at the startup. So I wrote the folloing script to obtain that.

http://blog.ishans.info/2011/09/25/set-brightness-automatically-at-the-startup-in-linux/

Using this same script (by editing it to pass the brightness level as an argument) you’ll be able to set the display brightness from the terminal.

If you need any help, feel free to contact me from ishanishans[dOt]info

25 09 2011
Ishan Somasiri

my email address is ishan[at]ishans[dot]info. Above post doesn’t correctly show it :s

27 10 2011
gamma ray

under “power management” adjust your preferred settings and then authenticate no need to use the terminal and sudo et al…

2 11 2011
Joe

You rock!! :) Thanks for sharing this.

8 11 2011
iia

I have been looking for something like this forever!! All the other forums and articles state the obvious ways to do it that were clearly not working..

15 11 2011
kumar

waste ubuntu………………………how to change screen brightness……

15 11 2011
kumar

ubuntu its worst compare to windows

18 11 2011
Ubuntu 11.10 showing black screen after installation

[...] within Ubuntu: ———————- https://help.ubuntu.com/11.04/ubuntu…dimscreen.html http://wilmor24.wordpress.com/2010/0…-ubuntu-10-04/ ———————- Let us know if this [...]

20 11 2011
mihaidima

xgamma trick worked perfectly! i’ve been searching a solution for this for a lot of time. thanks a lot! great job!

5 01 2012
martinst

How can that command modified to adjust a second screen?
Thank you

16 01 2012
andreicandrianu

AAAAA….I can see again…not blind anymore from the screen…thank you a lot…

11 04 2012
Gursel Mutlu

Thank you for the great tip. Now, I have a screen on/off button on my laptop:

Here are the steps:

1. Change owner of related config file so no need to execute as root:
sudo chown user.user /sys/devices/pci0000\:00/0000\:00\:02.0/config
(got it executed after reboot by putting that in /etc/rc.local)

2. Create a script:
toggle_screen.sh:
if [ -e /tmp/blank_screen ]; then
setpci -s 00:02.0 F4.B=ff
rm /tmp/blank_screen
else
setpci -s 00:02.0 F4.B=00
touch /tmp/blank_screen
fi

3. Add a custom shortcut key for the script in “System>Preferences>Keyboard Shortcuts”

15 04 2012
tim545

thanks for the post it helped out alot!

I used this to find my VGA controller:
‘lspci’

Then to change the brightness used:
‘sudo setpci -s xx:xx.x F4.B=xx’

14 05 2012
Ricardo Almeida V

Thanks!

18 05 2012
Joel

Alternatively, you could use ‘xrandr’ to modify screen brightness settings. Managed to change the brightness on my external monitor using this method. Mine doesn’t seem to have a pci entry. As detailed here: http://joeltong.org/blog/?p=166

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.