【xsel】 剪切板操作指令【linux】
安装
sudo apt-get install xsel
复制到剪贴板
echo '待复制的内容' | xsel -i -b 或 echo '待复制的内容' | xsel --input --clipboard
cat | xsel -i -b 或 cat | xsel --input --clipboard
获取剪贴板内容
xsel -o -b 或 xsel --output --clipboard
清空剪贴板
xsel -c
【xsel】 X11 selection and clipboard manipulation tool.【linux】
Use a command's output as input of the clip[b]oard (equivalent to Ctrl + C):
echo 123 | xsel -ib
Use the contents of a file as input of the clipboard:
cat file | xsel -ib
Output the clipboard's contents into the terminal (equivalent to Ctrl + V):
xsel -ob
Output the clipboard's contents into a file:
xsel -ob > file
Clear the clipboard:
xsel -cb
Output the X11 primary selection's contents into the terminal (equivalent to a mouse middle-click):
xsel -op
腾图小抄 SCWY.net v0.03 小抄561条 自2022-01-02访问370206次