Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to display all events that are generated in Xorg? Such as keyboard pressed, mouse events...?

share|improve this question
up vote 10 down vote accepted

A pretty quick search would likely yield xev as a result. It will not show you everything that is pressed or typed in X ever. But rather, will allow you to see information about keycodes and mouse movements.

However, with the -root option, you might be able to get xev to monitor the whole X session. Note, if you do this, you'll make it pretty difficult to actually interact with any program since xev will be capturing all input.

xev -root comes with an implied "YMMV". Another possible solution is to use xinput to get the job done (though you need a recent version (1.6.1 or above)):

$ xinput test-xi2 --root

While the above should be able to capture all events, if your xinput doesn't support test-xi2 or --root, you can use xinput test on a particular keyboard or mouse device.

See also this other question: Record every keystroke and store in a file

share|improve this answer
Actually, xev should show you all events... it's just that it only monitors one window at a time. Perhaps one could hack a script to launch multiple copies of xev each monitoring one window so that you end up monitoring all of them? – Celada Jul 24 '14 at 8:02
xev and xinput test don't show you touch events while xinput test-xi2 does. – dkreuter May 7 '15 at 9:01
@dkreuter, I have added your qualification inline. – HalosGhost May 7 '15 at 13:16
"However, with the -root option, you might be able to get xev to monitor the whole X session." <= This is wrong. This way, xev will only capture events on the "root window", i.e. normally your desktop background. xinput is the correct solution for capturing all events regardless of the currently active window. – Fritz Nov 17 '15 at 13:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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