Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
Not a duplicate, but definetly related, is this question and especially the answers given –  Bananguin Apr 21 at 18:53

2 Answers 2

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.

share|improve this answer

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.

share|improve this answer
1  
To simplify things ... this is what I do: alias pbcopy='xsel --clipboard --input'; alias pbpaste='xsel --clipboard --output' I chose the names to match the MacOS commands. –  Bananguin Apr 21 at 18:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.