IT lexicon › Infra & Ops › xdotool

xdotool

Infra & Ops På svenska → Updated: 2026-10-09
More info
Creator
Jordan Sissel
Released
Type
Command-line tool
License
BSD-3-Clause
Source
github.com/jordansissel/xdotool

The command-line tool that impersonates the user: it presses keys, moves the mouse, and finds, focuses and moves X11 windows from a shell script.

Jordan Sissel, later known for Logstash, released xdotool in 2007 as a way to drive programs that had no command-line interface of their own. xdotool key ctrl+alt+t sends a key combination, xdotool type 'text' types a string, xdotool mousemove 400 300 click 1 moves and clicks, and xdotool search --name Firefox windowactivate finds a window and gives it focus. Commands chain on a single line, and the libxdo library does the same from C. Input goes through the XTEST extension, which feeds events into the server as if they came from the keyboard, and window management through the EWMH properties, so it works with any modern window manager.

Two pitfalls are well known. With --window the keys go via XSendEvent instead, which many programs ignore because the event is flagged as synthetic; without it, everything lands in whichever window happens to have focus when the script runs, which has typed the occasional password into a chat box. Wayland has no equivalent of XTEST, and successors such as ydotool have to go through the kernel's uinput, with the privileges that requires.

← Back to the lexicon