← 返回命令列表

Linux command

xsel 命令

文本

涉及管道、覆盖或删除,执行前请先确认路径和参数。

常用示例

Copy

echo 123 | xsel -ib

Example

cat [path/to/file] | xsel -ib

Output

xsel -ob

Example

xsel -ob > [path/to/file]

Clear

xsel -cb

Example

xsel -op

说明

xsel manipulates X11 clipboard and selection buffers. It can read, write, clear, and exchange content between primary selection, secondary selection, and clipboard. Similar to xclip but with different syntax and additional features.

参数

-i, --input
Read from stdin
-o, --output
Write to stdout
-c, --clear
Clear selection
-b, --clipboard
Use clipboard selection (Ctrl+C/V)
-p, --primary
Use primary selection (middle click)
-s, --secondary
Use secondary selection
-a, --append
Append to selection

FAQ

What is the xsel command used for?

xsel manipulates X11 clipboard and selection buffers. It can read, write, clear, and exchange content between primary selection, secondary selection, and clipboard. Similar to xclip but with different syntax and additional features.

How do I run a basic xsel example?

Run `echo 123 | xsel -ib` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -i, --input do in xsel?

Read from stdin