LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices


Reply
  Search this Thread
Old 05-21-2011, 07:34 PM   #1
belltown
LQ Newbie
 
Registered: Nov 2010
Posts: 4

Rep: Reputation: 0
How do I change screen brightness from a terminal?


I'm running Ubuntu 11.04 with the Gnome Classic (No effects) display manager. My laptop's brightness keys work. However, when I boot or resume from suspend when using the integrated Intel graphics card the display brightness is turned all the way down, and I have to turn up the brightness using the brightness function keys so I that can see the display. I'd like to automate this by putting a terminal command in a script so I can automatically turn up the screen brightness when the system boots.

I've tried the following commands with no success:

Code:
echo 9>/sys/class/backlight/acpi_video0/brightness
What ever I echo in the brightness file has no effect on the screen brightness, and nothing changes in the /sys/class/backlight/acpi_video0/brightness or actual_brightness files. The contents of these files do change, however, if I change the brightness using the keyboard function keys.

Code:
setpci -s 00:02.0 F4.B=10
Some posts have suggested this command might work, but in my case it has no effect. The contents of the F4 register remain at 00, even if I change the screen brightness with the function keys.

Code:
xbacklight -set 90
Using this command I can change the value of xbacklight (i.e. xbacklight -get shows the new value), but the screen brightness does not change. However, if I change the screen brightness using the keyboard function keys then the value of xbacklight -get shows the new value.

Code:
acpi_backlight=vendor
I've tried putting this command on the linux command line when I boot. Even with this parameter I'm still unable to change the screen brightness from the terminal. This parameter also disables the keyboard brightness function keys.

Any suggestions of anything else I could try to change the screen brightness from a terminal?
 
Old 05-22-2011, 03:04 PM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
I would look under the Gnome keyboard shortcut configuration, if I remember rightly from when I used Ubuntu you can see what command it runs when you press the brightness keys and then you should be able to run that from terminal...
 
0 members found this post helpful.
Old 05-23-2011, 09:35 AM   #3
roygbiiv
LQ Newbie
 
Registered: May 2011
Distribution: Arch Linux
Posts: 25

Rep: Reputation: 13
Quote:
Code:
echo 9>/sys/class/backlight/acpi_video0/brightness
What ever I echo in the brightness file has no effect on the screen brightness, and nothing changes in the /sys/class/backlight/acpi_video0/brightness or actual_brightness files. The contents of these files do change, however, if I change the brightness using the keyboard function keys.
does this work?
Code:
sudo echo 9>/sys/class/backlight/acpi_video0/brightness
remember you can only echo values 0-24 (0 darkest - 24 brightest). i use a bash script that i run with sudo for this purpose. it takes the brightness level as argument:

Code:
#!/bin/bash
# set screen brightness level

if [ "$#" = "0" ]; then
	level= cat /sys/class/backlight/acpi_video0/brightness
	echo -n $level
else
	echo  $1 > /sys/class/backlight/acpi_video0/brightness
fi

Last edited by roygbiiv; 05-23-2011 at 09:48 AM.
 
0 members found this post helpful.
Old 05-24-2011, 12:07 PM   #4
belltown
LQ Newbie
 
Registered: Nov 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Snark1994 View Post
I would look under the Gnome keyboard shortcut configuration, if I remember rightly from when I used Ubuntu you can see what command it runs when you press the brightness keys and then you should be able to run that from terminal...
No, there are no keyboard shortcut keys for the brightness controls. I've found some configurable settings under gconf-editor in the Gnome Power Manager, but nothing tells me what Gnome is using to set the brightness.
 
Old 05-24-2011, 12:15 PM   #5
belltown
LQ Newbie
 
Registered: Nov 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by roygbiiv View Post
does this work?
Code:
sudo echo 9>/sys/class/backlight/acpi_video0/brightness
remember you can only echo values 0-24 (0 darkest - 24 brightest). i use a bash script that i run with sudo for this purpose. it takes the brightness level as argument:

Code:
#!/bin/bash
# set screen brightness level

if [ "$#" = "0" ]; then
	level= cat /sys/class/backlight/acpi_video0/brightness
	echo -n $level
else
	echo  $1 > /sys/class/backlight/acpi_video0/brightness
fi
That doesn't work. I can access the acpi brightness file, but any value I try to echo into that file has no effect, e.g:

Code:
root@john-laptop:/home/john# sudo su
root@john-laptop:/home/john# cat /sys/class/backlight/acpi_video0/brightness
10
root@john-laptop:/home/john# echo 5> /sys/class/backlight/acpi_video0/brightness 

root@john-laptop:/home/john# cat /sys/class/backlight/acpi_video0/brightness
10
 
Old 03-20-2013, 12:10 AM   #6
Evgenii Frolov
LQ Newbie
 
Registered: Mar 2013
Location: Tomsk-Moscow (Russia)
Distribution: Gentoo
Posts: 7

Rep: Reputation: Disabled
Worked for me!

Quote:
Originally Posted by belltown View Post
That doesn't work. I can access the acpi brightness file, but any value I try to echo into that file has no effect, e.g:

Code:
root@john-laptop:/home/john# sudo su
root@john-laptop:/home/john# cat /sys/class/backlight/acpi_video0/brightness
10
root@john-laptop:/home/john# echo 5> /sys/class/backlight/acpi_video0/brightness 

root@john-laptop:/home/john# cat /sys/class/backlight/acpi_video0/brightness
10
This worked for me!!! Add quotes around a number!!!
Code:
sudo echo "9">/sys/class/backlight/acpi_video0/brightness
Quote:
Originally Posted by roygbiiv View Post
does this work?
Code:
sudo echo 9>/sys/class/backlight/acpi_video0/brightness
remember you can only echo values 0-24 (0 darkest - 24 brightest). i use a bash script that i run with sudo for this purpose. it takes the brightness level as argument:
For me it is 0-20 range!
 
Old 09-17-2014, 03:50 AM   #7
tcuc
LQ Newbie
 
Registered: Mar 2012
Posts: 4

Rep: Reputation: Disabled
Question Worked great! as root...

this worked great:
Code:
echo "24">/sys/class/backlight/acpi_video0/brightness
but how can i do this as a regular user?
I want to bind this to a hotkey in openbox but i cant exactly do stuff as root there.
 
Old 09-17-2014, 04:28 AM   #8
Evgenii Frolov
LQ Newbie
 
Registered: Mar 2013
Location: Tomsk-Moscow (Russia)
Distribution: Gentoo
Posts: 7

Rep: Reputation: Disabled
Quote:
Originally Posted by tcuc View Post
but how can i do this as a regular user?
I want to bind this to a hotkey in openbox but i cant exactly do stuff as root there.
You should use "xbacklight" package then. If you have it installed then first of all see
Code:
man xbacklight
. There you can find, e.g.
Code:
xbacklight -inc 20
It increases brightness on 20%. It is the best way.
xbacklight man page on-line.
 
Old 09-17-2014, 06:43 AM   #9
tcuc
LQ Newbie
 
Registered: Mar 2012
Posts: 4

Rep: Reputation: Disabled
Thumbs up Perfect!

that was perfect! thanks allot!
 
Old 09-17-2014, 08:01 AM   #10
Evgenii Frolov
LQ Newbie
 
Registered: Mar 2013
Location: Tomsk-Moscow (Russia)
Distribution: Gentoo
Posts: 7

Rep: Reputation: Disabled
Quote:
Originally Posted by tcuc View Post
that was perfect! thanks allot!
You are wellcome! Have a nice linux time and smooth workflow with it (=
 
Old 01-06-2015, 04:24 AM   #11
feeling
LQ Newbie
 
Registered: Jan 2015
Posts: 3

Rep: Reputation: Disabled
Hi, I'm new at linux and got a similiar problem:

Hotkeys won't work.
(sudo) echo xx>/sys... gives bash: /sys/class/backlight/acpi_video0/brightness: Permission denied
(sudo) echo "xx">/sys... gives the same
btw: brightness has -rw-r--r--

then I installed xbacklight
but no matter what I wrote in commandline (xbacklight -get, xbacklight -set 10, xbacklight -inc 20, ...) nothing happens nor output.
Can someone help me?

I'm working on a Thinkpad Edge something with Linux Mint 17 and cinnamon


Please feel free to correct my english so that I can improve it.
 
Old 01-06-2015, 01:53 PM   #12
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
Code:
sudo tee /sys/class/backlight/acpi_video0/brightness <<< "value"
EDIT: Your English is very good, but it should be:
"and I have a similar problem"
"nothing happens and there is no output"

Last edited by Head_on_a_Stick; 01-06-2015 at 01:56 PM.
 
Old 01-06-2015, 03:13 PM   #13
feeling
LQ Newbie
 
Registered: Jan 2015
Posts: 3

Rep: Reputation: Disabled
Your code gives just out 1 or 5 or 10 or whatever I wrote for value. But the actual brightness doesn't change.
Do you have more suggestions, maybe?


Thanks anyway
 
Old 01-06-2015, 03:20 PM   #14
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
What is the output of:
Code:
ls /sys/class/backlight
If there are other backlight folders, try modifying the "brightness" file in there instead.

Which kernel version and graphics card are you using?
 
Old 01-06-2015, 06:34 PM   #15
feeling
LQ Newbie
 
Registered: Jan 2015
Posts: 3

Rep: Reputation: Disabled
great, the command aplied on ...radeon_bl0/brightness works.
thanks for that hind.

Quote:
Originally Posted by Head_on_a_Stick View Post
Which kernel version and graphics card are you using?
3.13.0-24-generic and [AMD/ATI] Kabini [Radeon HD 8240]
But I think that doesn't matter anymore.

Thanks for your help. Good night
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Bind certain keys to change screen brightness alquery Linux - General 10 08-24-2010 06:38 PM
ctrl+up|down don't change screen brightness any more zoran119 Slackware 1 07-17-2010 01:44 PM
Brightness of screen does not change. rao_ec@yahoo.com Ubuntu 3 10-07-2009 10:29 PM
how to change screen resolution in terminal (ubuntu) sunnior Linux - Newbie 1 09-25-2008 08:32 AM
How to change screen brightness? (Debian + Fujitsu T4010D) Buttpt Linux - Newbie 4 02-28-2008 11:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook

All times are GMT -5. The time now is 01:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration