I had to change keyboards at work and they gave me a mac keyboard that wasn't in use. I configured most of it to the point where I can use it, but I noticed that I need to press the fn key to activate the Functions F1~F19 and I was wondering if there is anyway I could flip that.

So what I want to do is have the Function keys as default, and need to hit fn whenever I want the other function of the key, such as Volume Up or Eject Disc


Typing this in terminal:

sudo su -c "echo -n 0x02 > /sys/module/hid_apple/parameters/fnmode"

enables F keys without needing FN.

To restore, change 0x02 with 0x01.

Must be run after each reboot.

  • 2
    Add the command to /etc/rc.local script and it will be executed on boot at the end of each multiuser runlevel. – girardengo Apr 17 '14 at 13:44
  • 1
    Don't worry, no question is stupid. Yes, you need superuser permissions to edit the file. Type sudo vi /etc/rc.local (vi or another text editor, like nano or gedit) – girardengo Apr 17 '14 at 14:11
  • 1
    Oh, I mean do I need to copy in the command that you gave me with the sudo permissions into the file? or should I copy the line excluidng the sudo su? – Rodrigo Sasaki Apr 17 '14 at 14:28
  • 3
    Sorry I did not understand. You have to just copy the command echo -n 0x02 > /sys/module/hid_apple/parameters/fnmode – girardengo Apr 17 '14 at 15:56
  • 1
    This doesn't work with ubuntu 18.04 after reboot. – Shivam Jan 8 '20 at 7:34

This is covered in some depth at the Ubuntu Community Wiki, including various ways to do it permanently, systemwide.

Not the answer you're looking for? Browse other questions tagged or ask your own question.