When I use the keyboard for certain Firefox functions, and when I do it fast, time and time again something unintentional happens. When I try to do it slowly, everything’s fine. So there must be some timing issue, or an additional key I press, without me noticing it.

Is there a tool which logs the last 20 (or so) keys I pressed? It also has to show which keys were hold down and before which key press they were released.

As soon as it happens again, I’ll stop typing and check the log to learn which keys I pressed in which order.

It has to be a free/libre tool for GNU/Linux.

1 Answer 1


You can log all X11 keystrokes with various tools of which xinput is the one you probably already have installed. Run xinput to find the id of the keyboard, eg for me it was 3:

$ xinput
 Virtual core keyboard        id=3    [master keyboard (2)]

the use

$ xinput --test-xi2 --root 3 >file

to record all keystrokes. Example output

EVENT type 13 (RawKeyPress)
    device: 3 (9)
    detail: 40

See here for a script to convert the output keycodes into something more readable.

Another tool is cnee part of Xnee. Use it with

$ cnee --record --keyboard

It also just prints raw keycodes. eg

6,2,0,0,0,105,0,1551948221,3,Virtual core keyboard

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.