One wrinkle on setting the brightness like this:
sudo echo 12 > /sys/class/backlight/backlight/brightness
If you try to do it from a non-root account using sudo, it will fail with the error "permission denied," despite the use of sudo. If I understand it correctly, this is because the sudo only applies to the echo command, not the file writing caused by the redirect operator.
Instead, execute the entire command in a privileged shell:
sudo sh -c "echo 12 > /sys/class/backlight/backlight/brightness"
This worked for me.
Edit: add missing quotation mark