There is a way to put some command output to system clipboard via xclip.
some-command | xclip -selection clipboard I'd like to perform a reverse task - Print system clipboard to terminal. How it can be done?
There is a way to put some command output to system clipboard via xclip.
some-command | xclip -selection clipboard I'd like to perform a reverse task - Print system clipboard to terminal. How it can be done?
According to the manpage the -o option to xclip shoves data in the opposite direction:
-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) In your above command, the -i is being assumed.
Another choice is the xsel program:
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.
So, just copy something to the clipboard and run xsel to print it to the terminal. You can have a read through man xsel for more advanced options like which clipboard should be used etc.
alias pbcopy='xsel --clipboard --input'; alias pbpaste='xsel --clipboard --output' I chose the names to match the MacOS commands.