3

On Ubuntu my Brightness keys don't work. So instead to open Ubuntu settings every time, I want to write a shell script to use in my .bashrc. Now I don't understand at all why the tee command in the following line seems to be neessary! Thanks!

sudo echo "937" | sudo tee /sys/class/backlight/intel_backlight/brightness 
Elder Geek
  • 36,752
v217
  • 368

1 Answers1

5

tee is not necessary in that command.

You just need to edit the file /sys/class/backlight/intel_backlight/brightness to add 937, as the file is only writeable by the owner, root (user with UID 0), any manner that can do exactly that would suffice.

You could just do:

sudo bash -c 'echo "937" >/sys/class/backlight/intel_backlight/brightness' 

In that command, tee is being run with sudo i.e. being run as root as the file /sys/class/backlight/intel_backlight/brightness in only writable by root.

Even you can start an interactive-login session of your SHELL for root by:

sudo -i

and open-write-close the file with any command or your editor of choice (and later exit that session), but that would be clumsy and unnecessary as you want to run just a single command.

Also you don't need the sudo with echo, do:

echo "937" | sudo tee /sys/class/backlight/intel_backlight/brightness 
heemayl
  • 93,925