Auto Pressing Multiple Keys Together in Linux
Posted on In QAThis 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?
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.