Ubuntu on Macbook Pro: set the function keys to act like F1-F12 by default (disable Fn default behavior)
put the following line in your ~/.bashrc
or ~/.zshrc
if you are using zsh
echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode
What? your sudo command asks your password? then
sudo visudo
#add this line
your-user-name ALL=(ALL:ALL) NOPASSWD:ALL
Don't you want to set this NOPASSWD option for security reasons? then put the following line into /etc/rc.local
instead. It should work.
echo 2 > /sys/module/hid_apple/parameters/fnmode