Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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. Forgive me, I merely do not know what a program like this would be called. Thanks!

share|improve this question

2 Answers 2

up vote 7 down vote accepted

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 exemple '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 you add it on Startup Applications it will press 'a' every two seconds.

Here is the documentation for Xdotool :

And here is the specific part on keyboard commands :

share|improve this answer

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".

share|improve this answer

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.