How to simulate pressing multiple keys together on Linux?

This post introduces a key presser on Linux with xvkb. But how to simulate pressing multiple keys together on Linux?

That is, I would like to have multiple keys such as "A" "B" "C" "D" pressed together and being hold. How to simulate this on Linux with programs/commands?

asked Oct 15, 2015 by anonymous

1 Answer

You can make use of xdotool (xdotool: command-line X11 automation tool) to simulate the keyboard pressing.

The command for pressing ABCD together will be:

xdotool sleep 5 keydown a keydown b keydown c keydown d

It will first sleep 5 seconds for you to click to focus on the target program's window. Then it will press down a b c and d (not release them anymore).

After you would like to release these keys. Just kill the xdotool instance by pressing Ctrl-C in the terminal.

Note: you will need to press abcd once again more on your keyboard to actually release these keys.

answered Oct 15, 2015 by Eric Z Ma (44,280 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...