← 返回命令列表

Linux command

xscreensaver-command 命令

文本

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

常用示例

Activate screensaver immediately

xscreensaver-command -activate

Lock screen

xscreensaver-command -lock

Deactivate screensaver

xscreensaver-command -deactivate

Restart screensaver daemon

xscreensaver-command -restart

Exit screensaver daemon

xscreensaver-command -exit

Show current status

xscreensaver-command -time

Watch for state changes

xscreensaver-command -watch

说明

xscreensaver-command controls a running xscreensaver daemon by sending client messages. It can activate, deactivate, or lock the screen, cycle through display modes, and query status. The -watch option streams state changes, useful for scripts that need to react to screensaver events. The -deactivate option can be called periodically to prevent screen blanking during video playback. Configuration is done through xscreensaver-settings, which writes preferences to ~/.xscreensaver.

参数

-activate
Blank screen immediately.
-deactivate
Simulate user activity; unblank screen.
-lock
Lock screen immediately.
-cycle
Switch to next screensaver hack.
-next / -prev
Switch to next/previous hack.
-select _n_
Switch to hack number n.
-restart
Restart the daemon with same arguments.
-exit
Exit daemon (fails if locked).
-time
Show last activation/deactivation time.
-watch
Print state changes continuously.
-version
Print the version of the running xscreensaver daemon.
-quiet
Print output only if an error occurs.
-verbose
Print verbose output (default).

FAQ

What is the xscreensaver-command command used for?

xscreensaver-command controls a running xscreensaver daemon by sending client messages. It can activate, deactivate, or lock the screen, cycle through display modes, and query status. The -watch option streams state changes, useful for scripts that need to react to screensaver events. The -deactivate option can be called periodically to prevent screen blanking during video playback. Configuration is done through xscreensaver-settings, which writes preferences to ~/.xscreensaver.

How do I run a basic xscreensaver-command example?

Run `xscreensaver-command -activate` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -activate do in xscreensaver-command?

Blank screen immediately.