Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-13-2005, 09:33 PM   #1
Registered: Jun 2004
Location: FL, USA
Distribution: Slackware 9.1
Posts: 190

Rep: Reputation: 30
Setting num lock to "on" at boot or log in.

Is there a way to mae it so that num lock isn't reset to off everytime the computer boots?
Using Slackware 9.1, KDE/KDM
Old 06-13-2005, 09:54 PM   #2
Senior Member
Registered: Jun 2003
Distribution: Mint 13/15, CentOS 6.4
Posts: 2,020

Rep: Reputation: 47
i've been using linux for a couple years, and i've never been able to get a gui to launch with numlock on. it's such a simple thing, you'd think someone would have an easy solution. but nothing i've tried has ever worked. search google and try the various methods, maybe you'll have better luck.
Old 06-13-2005, 10:46 PM   #3
Senior Member
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid
Posts: 4,734
Blog Entries: 12

Rep: Reputation: 462Reputation: 462Reputation: 462Reputation: 462Reputation: 462
In debian there is a small app called numlockx, that does just that. Turns the numlock on at login/boot.

If you are running KDE, you can open the Control Center>Peripherals>Keyboard>NumLock on KDE Startup and choose Turn on.
Old 06-13-2005, 11:31 PM   #4
Registered: Sep 2003
Distribution: Slackware
Posts: 626

Rep: Reputation: 38
This is what works for me in Slack 10:

# This turns on numlock:
for tty in /dev/tty[1-6]; do
/usr/bin/setleds -D +num < $tty
Put it in the /etc/rc.d/rc.local file. Make sure rc.local is executable
Old 06-14-2005, 03:00 AM   #5
Senior Member
Registered: Sep 2003
Location: Egypt
Distribution: Arch
Posts: 1,528

Rep: Reputation: 47
install numlockx and make sure it runs at startup

and here is a detailed howto

Last edited by heema; 06-14-2005 at 03:04 AM.
Old 06-14-2005, 06:19 AM   #6
Senior Member
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
I have, in my ~/.xinitrc numlockx starting before my window manager - this does the job fine...
Old 06-14-2005, 09:34 AM   #7
Senior Member
Registered: Jun 2003
Distribution: Mint 13/15, CentOS 6.4
Posts: 2,020

Rep: Reputation: 47
numlockx doesn't work for me, either. maybe it's because i'm using xfce4 and it's not going through startx but startxfce4? after it didn't work in ~/.xinitrc, i put it in both ~/.xfce4/xinitrc and in the global xfce4 xinitrc, but still no numlock. it flashes for second while X is starting, then it turns off again, but it does that normally anyway. i've resigned myself to the fact that i'm just never going to have default numlock in linux.
Old 06-14-2005, 09:40 AM   #8
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,257

Rep: Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689
numlockx didn't work for me either, so I found the following c program:
#include <X11/extensions/XTest.h>
#include <X11//keysym.h>

int main(){
        Display* disp = XOpenDisplay(NULL);
        if (disp == NULL) return 1;
        XTestFakeKeyEvent(disp, XKeysymToKeycode(disp, XK_Num_Lock),
                True, CurrentTime);
        XTestFakeKeyEvent(disp, XKeysymToKeycode(disp, XK_Num_Lock),
                False, CurrentTime);
        return 0;
Compile it like this:
gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o setnumlock setnumlock.c -lX11 -lXtst
and add the line:
/usr/X11R6/bin/setnumlock &
before invoking your wm.

Old 05-30-2006, 11:46 AM   #9
Senior Member
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 62
An old reply to this often asked question by user: dracae (Hmmm. Haven't seen him lately.) Works great in Debian.
install console-tools if not already, add
to /etc/console-tools/config
Edit: Oops I posted to this thread by accident. Guess I'll leave it. Might help somebody.

Last edited by rickh; 05-30-2006 at 11:49 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
New SQUID user: How to clear the "access.log" and "store.log" automatically? yuzuohong Linux - Networking 2 12-02-2006 05:37 AM
KDE "Logout" and "Lock Session" menu restoration powah Linux - Software 3 03-29-2005 08:02 PM
KDE "Lock Session" and "Logout" menu restoration tcma Linux - Software 0 01-29-2005 11:12 AM
CAPS LOCK strangeness -- "a" turns into "S" nschoena Linux - Software 6 06-04-2004 10:45 AM
Boot messages not the same as "dmesg" or "/var/log/messages"? massai Linux - General 5 03-10-2004 12:18 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:50 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration