Linux command
yank 命令
文本
涉及管道、覆盖或删除,执行前请先确认路径和参数。
常用示例
Select and copy
echo "[text]" | yank
Custom delimiter
echo "[text]" | yank -d "[\n]"
Copy to X clipboard
echo "[text]" | yank -x
With selection command
echo "[text]" | yank -- xclip
说明
yank reads input from a pipe or file and presents it in a terminal selection interface. The user navigates lines or fields with arrow keys, selects the desired text, and yank copies it to the clipboard or passes it to a specified command. By default, input is split into lines. The -d option sets a custom delimiter for splitting input into selectable fields, useful for extracting specific columns from structured output. The -l option forces line-by-line splitting regardless of content. Clipboard integration works through an external command such as xclip or xsel, specified after --. On systems with X11, the -x flag provides a shortcut for X clipboard access. The tool is designed to fit naturally into Unix pipelines, accepting input from any command that writes to stdout.
参数
- -d _DELIM_
- Field delimiter.
- -x
- X clipboard.
- -l
- Line delimiter.
- -- _CMD_
- Yank command.
FAQ
What is the yank command used for?
yank reads input from a pipe or file and presents it in a terminal selection interface. The user navigates lines or fields with arrow keys, selects the desired text, and yank copies it to the clipboard or passes it to a specified command. By default, input is split into lines. The -d option sets a custom delimiter for splitting input into selectable fields, useful for extracting specific columns from structured output. The -l option forces line-by-line splitting regardless of content. Clipboard integration works through an external command such as xclip or xsel, specified after --. On systems with X11, the -x flag provides a shortcut for X clipboard access. The tool is designed to fit naturally into Unix pipelines, accepting input from any command that writes to stdout.
How do I run a basic yank example?
Run `echo "[text]" | yank` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -d _DELIM_ do in yank?
Field delimiter.