Linux · Accessories
ydotool
ydotool is a command‑line utility that simulates keyboard and mouse input on Linux.
- License
- GPL-3.0
- Latest version
- 1.0.4
What is ydotool?
ydotool lets you script mouse movements, clicks, and keystrokes, acting as a lightweight alternative to AutoHotkey. It has been in the Linux ecosystem for several years and is packaged in the major distributions, showing reasonable maturity. The tool works by sending synthetic input events through the uinput kernel interface.
It is aimed at power users and developers who need quick automation without a full‑blown scripting language. Because it runs from the terminal, it fits well into shell scripts, cron jobs, or custom key‑binding setups.
Compared with AutoHotkey, ydotool feels more manual and less feature‑rich; there is no built‑in GUI editor or hotkey manager. However, its simplicity means lower overhead and easy integration with existing Linux tooling.
Best for: Users who need simple, scriptable input automation on Linux without a full scripting environment.
Key features of ydotool
- Send arbitrary key sequences
- Simulate mouse movement and button clicks
- Support for relative and absolute mouse coordinates
- Works with standard input devices via uinput
- Can be called from shell scripts
- Lightweight binary with no heavy dependencies
Pros
- Runs on all major distros (arch, fedora, opensuse, ubuntu)
- No GUI required; perfect for headless setups
- Small footprint and fast execution
Cons
- No graphical hotkey manager; you must script everything
- Limited to basic input simulation; lacks advanced conditionals
- Requires root or appropriate uinput permissions
Windows programs ydotool replaces
How to install ydotool on Linux
sudo apt install ydotoolsudo dnf install ydotoolsudo pacman -S ydotoolsudo zypper install ydotoolTips for Windows users
AutoHotkey scripts cannot be used directly; rewrite the automation as shell commands that call ydotool with the required key or mouse actions. Install the package from your distro, add your user to the "input" group or set the proper udev rule to allow non‑root access, then test small snippets before converting larger scripts.
ydotool: frequently asked questions
How do I install ydotool on Ubuntu?
Use sudo apt install ydotool; the package is available in the official repositories.
Do I need root to run ydotool?
Yes, unless you configure udev rules or add your user to the appropriate group to grant uinput access.
Can ydotool simulate mouse wheel scrolling?
It can send mouse button events, including wheel buttons, by specifying the appropriate button code.
Is there a way to bind ydotool commands to a keyboard shortcut?
Yes, you can create custom shortcuts in your desktop environment that call a shell script invoking ydotool.
Updated