Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I type a lot, a TON and am curious how much, so I thought it might be very interesting to have a tool count the total keystrokes I do every day on my linux laptop. Is there a tool that can do that? If not, how can I build it myself? It would need to be global though, meaning all keystrokes, not just when a program has focus (and that has been the problem so far)
I don't know of any tools and besides adding code to the keyboard driver and rebuilding your kernel, you can look at the /dev/input/ tree. For instance mine has a by-id subdirectory where it has links showing that /dev/input/event3 is one of my keyboard driver files. Turns out if I do "sudo cat /dev/input/event3" it shows me a bunch of binary stuff. I can also do "suco hexdump /dev/input/event3" and then it shows definitive packets where 3-4 of them come out with each keystroke, probably some indicating the down key and some indicating the key release. You could either determine what that entire protocol is, or instead figure out if it's always exactly 3 or 4 records per keystroke and then write a program to look at this file and count the number of records transcended over a certain time.
If I were in your shoes I'd write a program to measure that, see how much I did type, and then send a post out to the forum challenging people to exceed you, that is without cheating and distorting the rules.
Check 'cat /proc/bus/input/devices' for input device nodes for your keyboard, it will usually be something like '/dev/input/event3' with a different number than 3. It will print the number of characters typed when you press Ctrl-C.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.