A common yet seldom known solution to moving the mouse using the keyboard is discussed in this document. This article will be a huge timesaver to someone who is not comfortable using a terminal/console or who just had a mouse go dead for whatever reason. You can check most linux books and its not even documented anywhere.
Read on to find out how to move the mouse in X using just the keyboard.....
Whenever you are logged into a gui (KDE, Gnome, or any other Linux gui), you can move the mouse pointer using only the keyboard.
First, you need to turn this feature on. To do this, press Shift + NumLock.
You can now press the 1 - 9 keys on the number pad (the one that is generally on the right side of your keyboard) to move the mouse. Try it now to see how each number affects the mouse pointer.
If you need to select an item, you can select it by hitting the 5 key on your number pad. Hitting the 5 key twice is equivalent to double clicking. If you need to click and hold something, you use the 0 key. You can release it by pressing the 5 key. The 5 key by default is also the left mouse key (whatever you have assigned for it, i.e. in a standard right hand mouse it would be a left click).
If you need to left, middle, or right click on something. The real solution for a left click though is to first hit the / key (the one on the number pad) then the 5 key. If you press the * (one on the number pad) and then the 5 key, that will be a middle mouse click or equavalent to pressing both mouse buttons at the same time on a two button mouse. If you press the - key (on the number pad) and then a 5, that will be equivalent to a right mouse click.
to recap this:
Shift + Numlock turns the keyboard mouse feature on.
Use the keypad number 1 - 9 keys to move
Use the 5 key to select or double left click
Use the 0 key to click and hold.
/ + 5 = Left click (for a right handed mouse, or right click for a left handed mouse)
* + 5 = Middle click (again, for a right handed 3 button mouse....ahhh, or even left handed 3 button mouse, or clicking both buttons on a 2 button mouse)
- + 5 = Right click (for a left handed mouse or a left click for a right handed mouse)
Press Shift + NumLock again to turn this feature off.