LinuxQuestions.org
Help answer threads with 0 replies.
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 03-15-2010, 08:47 AM   #1
Geriao
Member
 
Registered: Dec 2009
Distribution: Ubuntu Karmic Koala, Slackware 13.0
Posts: 66

Rep: Reputation: 17
Lightbulb Sending command to /sys/... or /proc/acpi/...


There were a couple occasions where I want to send commands to "files" in these locations:
  • To increase/decrease the brightness level on a Compaq Presario laptop, but issuing "echo 20 > /proc/acpi/video/.../brightness"
  • To make a Dell Inspiron 1525 laptop suspend to ram, by issuing "echo mem > /sys/power/state"

If I try one of these just like that, I get a "Permission denied". Yet, even if I use "sudo echo mem > /sys/power/state", I still get the same error.

But if I put this line of code in a bash script then run it with sudo, it works.

Is that a bug? Why can't I sudo it from the terminal?
 
Old 03-15-2010, 10:02 PM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
The reason is that the redirection is being done on the output of 'sudo echo mem', at which point it only has user privileges (redirection is a shell function, not a function of the echo). If you need to do it from the command line, one way is to start a shell under sudo:
Code:
sudo bash -c 'echo mem >/sys/power/state'
 
1 members found this post helpful.
Old 03-16-2010, 06:37 AM   #3
Geriao
Member
 
Registered: Dec 2009
Distribution: Ubuntu Karmic Koala, Slackware 13.0
Posts: 66

Original Poster
Rep: Reputation: 17
That explains it!
Thanks!!
 
  


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
/proc/sys/fs/file-nr ?? jharris Linux - General 5 07-27-2009 06:07 PM
ACPI: 2.6.17.7; nothing in /proc/acpi/fan; fans not running; problem not seen before. zetabill Linux - Kernel 1 07-30-2006 04:27 PM
/proc vs /sys alaios Linux - Newbie 1 06-11-2005 11:56 PM
/proc replaced by /sys in 2.6? Thaidog Linux - General 1 04-25-2005 07:09 PM
kernel 2.4.20 & acpi-20021212-2.4.20.diff => no /proc/acpi Tinkster Linux - Software 5 03-24-2003 01:56 PM

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

All times are GMT -5. The time now is 10:34 AM.

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