Gentoo Wiki


This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other

Annoyed that numlock is turned off by default? This will help you have it automatically turned on.


For Console Users

system ~#
rc-update add numlock defaultImage:CursorOFF.gif

For users of graphical environments

system ~#
emerge numlockxImage:CursorOFF.gif

Alternative: gnome-extra/lock-keys-applet Installing this enables you to put a small applet on your gnome panel that shows you the current state of your keys. Apart from being good for people with keyboards without status leds it also remembers your current states for eg numlock between sessions.


For KDM users

- as posted by tosho in the

system ~#
echo '/usr/bin/numlockx on' >> /usr/kde/3.5/share/config/kdm/XsetupImage:CursorOFF.gif

Assuming you have kde 3.5 series (if not, replace 3.5 with 3.4)

KDM 3.5
by magik 7-13-07

numlock x isn't needed to enable numlock on kdm startup, kdm can handle it automatically just add NumLock=On (case sensitive) to /usr/kde/3.5/share/config/kdm/kdmrc

File: /usr/kde/3.5/share/config/kdm/kdmrc
Theme=/usr/kde/3.5/share/apps/kdm/themes/Pulsar KDM

For GDM Users

If you are using gdm, try adding the following code to /etc/X11/gdm/Init/Default above exit 0

File: /etc/X11/gdm/Init/Default
if [ -x /usr/bin/numlockx ]; then
       /usr/bin/numlockx on

Putting it at the top of the file should work, and then run gdm-safe-restart as root.

For SLiM Users

The slim login manager does not require numlockx

File: /etc/slim.conf
# Activate numlock when slim starts. Valid values: on|off
numlock		on

For Fluxbox and other Desktop Environment Users

You can add the location of numlockx tool (for instance /usr/X11R6/bin/numlockx) to the relevant session script in /etc/X11/Sessions. For example, the editted version of fluxbox session script looks like:


Per user

For KDE Users

KDE users have it fairly straightforward. See Control Center -> Peripherals -> Keyboard

For Gnome Users

For XFCE4.4 Users

Go to Settings -> Autostarted Applications and add a new application with this command : /usr/bin/numlockx on

For E17 Users

Go to "Configuration > Applications > Create a new application" and fill the fields as you normally would. Once created simply click "Add application.." inside the "startup" folder.

For other freedesktop Environments

You can put all kinds of programs that you want to autostart during startup in this folder. ~/Desktop/Autostart/ You can do this by making a symlink (not tested) or writing a small script that just starts it.. for example:

File: ~/Desktop/Autostart/02numlockx

numlockx on

Retrieved from ""

Last modified: Fri, 05 Sep 2008 23:14:00 +0000 Hits: 24,955