≡ Menu

How to: Linux turn on Num Lock on GNOME startup

Q. How do I make sure that numlock is always turn on GNOME Linux desktop system?

A. You need to install numlockx package, which enable NumLock in X11 sessions.

This little software allows you to start X with NumLock turned on which is a feature that a lot of people seem to miss and nobody really knew how to achieve this.

To install numlockx type the command:
# apt-get install numlockx

Now open your /etc/X11/gdm/Init/Default file and add line:
/usr/bin/numlockx on

Save and close the file.

You can also add line to /etc/X11/xinit/xinitrc. Open file:
# vi /etc/X11/xinit/xinitrc

At the beginning of file add line
/usr/bin/numlockx on

Save and close the file.

If you’re not root (or don’t have access to root account) and therefore you can modify neither config file, you can use your ~/.xinitrc ( in your home directory /home/you/.xinitrc file).
$ cd
$ vi .xinitrc

Append following line
/usr/bin/numlockx on

Save and close the file.

Reboot the system or restart the GNOME.

Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 1 comment… add one }
  • ntrrgc May 14, 2013, 9:39 am

    On nowadays’ distros xinitrc file has been deprecated in favor of xinitrc.d script directory, which provides better maintainability for packagers.

    So, instead of editing


    it’s better to create a script like this:

    vi /etc/X11/xinit/xinitrc.d/numlockx

    Then paste this code (don’t forget shebang line):

    /usr/bin/numlockx on

    And lastly, give that file execute permissions.

    chmod +x /etc/X11/xinit/xinitrc.d/numlockx

    Reboot to test it, and done.

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: