Linux command
pbcopy 命令
文本
涉及管道、覆盖或删除,执行前请先确认路径和参数。
常用示例
Copy text to clipboard
echo "[text]" | pbcopy
Copy file contents
pbcopy < [file.txt]
Copy command output
ls -la | pbcopy
Paste from clipboard
pbpaste
Paste to file
pbpaste > [file.txt]
说明
pbcopy copies standard input to the macOS clipboard (pasteboard). Its companion pbpaste outputs clipboard contents to standard output. These tools integrate the command line with the graphical clipboard, enabling scripted clipboard operations.
参数
- -pboard _name_
- Pasteboard name (general, ruler, find, font).
- -Prefer _type_
- Preferred data type (txt, rtf, ps).
FAQ
What is the pbcopy command used for?
pbcopy copies standard input to the macOS clipboard (pasteboard). Its companion pbpaste outputs clipboard contents to standard output. These tools integrate the command line with the graphical clipboard, enabling scripted clipboard operations.
How do I run a basic pbcopy example?
Run `echo "[text]" | pbcopy` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -pboard _name_ do in pbcopy?
Pasteboard name (general, ruler, find, font).