Loo*_*oom 10 bash xorg clipboard
有一种方法可以将一些命令输出通过xclip.
some-command | xclip -selection clipboard
Run Code Online (Sandbox Code Playgroud)
我想执行反向任务 - 将系统剪贴板打印到终端。怎么做?
根据联机帮助页,-o可以选择向xclip相反方向推送数据:
-i, -in
read text into X selection from standard input or files (default)
-o, -out
prints the selection to standard out (generally for piping to a file or program)
Run Code Online (Sandbox Code Playgroud)
在您的上述命令中,-i假设为 。
另一种选择是xsel程序:
Run Code Online (Sandbox Code Playgroud)By default, this program outputs the selection without modification if both standard input and standard output are terminals (ttys). Other? wise, the current selection is output if standard output is not a ter? minal (tty), and the selection is set from standard input if standard input is not a terminal (tty). If any input or output options are given then the program behaves only in the requested mode.
因此,只需将某些内容复制到剪贴板并运行xsel以将其打印到终端。您可以通读man xsel更高级的选项,例如应该使用哪个剪贴板等。