I was wondering if there was an open source program that would allow me to have a certain keystroke/key combination pressed every say, two seconds or so.

2 Answers 2


Yes, there is an open source program to create fake keyboard and mouse inputs for GNU/Linux. It is called Xdotool Install Xdotool.

To press a key (in this example 'a') every two seconds you can use a script like this :


while true; do
  xdotool key a
  sleep 2

If you make this script executable and add it to Startup Applications it will press 'a' every two seconds.

Here is the documentation for Xdotool

And here is the specific part on keyboard commands


If you are using a Logitech keyboard, there is a package called "g15macro" in the Ubuntu repo that is useful. Otherwise there are other open source applications such as "xmacro" and "xnee".

Your Answer

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

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