Linux command
wl-copy 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Copy text
wl-copy "[text]"
Pipe
ls | wl-copy
Example
wl-copy --paste-once "[text]"
Example
wl-copy < [path/to/image]
Example
wl-copy --sensitive "[password]"
Example
wl-copy --type text/html "[<b>bold</b>]"
Clear
wl-copy --clear
说明
wl-copy copies data to the Wayland clipboard. It can copy text from arguments or read binary data from stdin, automatically handling MIME types. The tool forks into the background by default to keep the clipboard contents available. Data can be piped into wl-copy for copying command output or file contents. It supports both the regular clipboard and the primary selection (for middle-click paste).
参数
- -o, --paste-once
- Only serve one paste request then exit
- -c, --clear
- Clear the clipboard instead of copying
- -p, --primary
- Use the primary selection instead of clipboard
- -n, --trim-newline
- Do not append newline character
- -t, --type _mime-type_
- Set the MIME type for the content
- -s, --seat _seat_
- Pick the seat to work with
- -f, --foreground
- Stay in foreground instead of forking
- --sensitive
- Hint that content is sensitive (e.g., passwords); clipboard managers may avoid persisting it in history
- -v, --version
- Display version information
- -h, --help
- Display help message
FAQ
What is the wl-copy command used for?
wl-copy copies data to the Wayland clipboard. It can copy text from arguments or read binary data from stdin, automatically handling MIME types. The tool forks into the background by default to keep the clipboard contents available. Data can be piped into wl-copy for copying command output or file contents. It supports both the regular clipboard and the primary selection (for middle-click paste).
How do I run a basic wl-copy example?
Run `wl-copy "[text]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -o, --paste-once do in wl-copy?
Only serve one paste request then exit