numlockx is a Linux utility that provides control over the status of the number lock key in X11 (X Window System) sessions. The number lock key is used to switch between the numeric keypad and the function keys on some keyboards.
In X11 sessions, the number lock key status is not always set to the desired state when the session starts. For example, some keyboard configurations may have the number lock key turned off by default, while others may have it turned on. numlockx provides a way to automatically set the number lock key status to the desired state at the start of an X11 session.
numlockx can be run as a standalone program or included in the X11 startup script. When run, numlockx sets the number lock key status to the specified state, which can be either “on” or “off”. The specified state is applied to all X11 sessions that are started after numlockx is run.
numlockx is useful for users who frequently switch between using the numeric keypad and the function keys, as it provides a way to ensure that the number lock key status is set to the desired state when an X11 session starts. This can help prevent unexpected behavior and increase productivity by eliminating the need to manually set the number lock key status each time an X11 session starts.
If you encounter the below error while running the command numlockx:
numlockx: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install numlockx |
Ubuntu | apt-get install numlockx |
Arch Linux | pacman -S numlockx |
Kali Linux | apt-get install numlockx |
Fedora | dnf install numlockx |
Raspbian | apt-get install numlockx |
numlockx Command Examples
1. Show the current number lock status:
# numlockx status
2. Turn the number lock on:
# numlockx on
3. Turn the number lock off:
# numlockx off
4. Toggle the current state:
# numlockx toggle