xdotool
fake keyboard/mouse input, window management, and more
xdotool is a command-line program for Linux that lets you script mouse and keyboard actions as if a real person were performing them. You can use it to type text, press keyboard shortcuts, click the mouse, move the cursor, and manage application windows, all from a terminal or a shell script. Under the hood it works through X11, the older windowing system that most traditional Linux desktops run on.
The window management side of xdotool covers quite a bit of ground. You can search for windows by name or class, resize them in bulk, bring them to the foreground, hide them, change their titles, and move them between virtual desktops if your window manager supports it. For example, a single xdotool command can find every visible terminal window on screen and resize them all to a fixed dimension at once.
Beyond the command-line tool, the repository also includes libxdo, a C library that exposes the same functionality so other programs can automate input and window operations programmatically.
One important limitation: xdotool only works on systems using X11. If your desktop is running on Wayland, which is the newer graphics system replacing X11 on many modern Linux distributions, most xdotool features including typing and window searching will not work. The README notes alternative tools that work under Wayland using a different approach.
Installation is available through the package manager on most major Linux distributions and on macOS via Homebrew or MacPorts. Building from source requires a handful of X11 development libraries and a standard make command. The project has been around for many years and is widely used in automation scripts and testing setups.