← 返回命令列表

Linux command

xdotool 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Search

xdotool search --onlyvisible --name firefox

Example

xdotool click 1

Example

xdotool getactivewindow

Focus

xdotool windowfocus --sync 12345

Type

xdotool type --delay 500 "Hello world"

Example

xdotool key Return

Move mouse

xdotool mousemove 100 200

Example

xdotool getmouselocation

说明

xdotool simulates keyboard and mouse input in X11. It can search for windows, send keystrokes, move/click the mouse, and manipulate windows, making it useful for automation and scripting.

参数

--delay milliseconds
Delay between keystrokes when typing
--clearmodifiers
Clear modifier keys before command
--sync
Wait for window to be visible
--onlyvisible
Search only visible windows
--name
Search by window name
--class
Search by window class
--window window_id
Target specific window

FAQ

What is the xdotool command used for?

xdotool simulates keyboard and mouse input in X11. It can search for windows, send keystrokes, move/click the mouse, and manipulate windows, making it useful for automation and scripting.

How do I run a basic xdotool example?

Run `xdotool search --onlyvisible --name firefox` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --delay milliseconds do in xdotool?

Delay between keystrokes when typing