How can I pipe the output of a command into my clipboard and paste it back when using a terminal? For instance:
cat file | clipboard
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One way of doing it follows:
Install
xclip, such as:sudo apt-get install xclipPipe the output into
xclipto be copied into the clipboard:cat file | xclipPaste the text you just copied into a
Xapplication:xclip -oTo paste somewhere else other than an
Xapplication, such as a text area of a web page in a browser window, use:Consider creating an alias:
To see how useful this is, imagine I want to open my current path in a new terminal window (there may be other ways of doing it like Ctrl+T on some systems, but this is just for illustration purposes):
Notice the
` `aroundv. This executesvas a command first and then substitutes it in-place forcdto use.Only copy the content to the
Xclipboard