Is it possible to copy the output into the clipboard without using the mouse?

For example, I would like to do something like this:

$ pwd >> clipboard

link|improve this question

cat /etc/passwd | xsel --clipboard – Abhisheietk Apr 10 at 7:25
feedback

2 Answers

up vote 11 down vote accepted

You can get and use the xclip and xsel commands. Instructions for obtaining and using them are here.

link|improve this answer
Thanks, I never knew that. – Dan McGrath Feb 5 '10 at 2:39
feedback

I'm afraid there is no such thing as "clipboard" in most linux shells, at least none I know of. There's a clipboard in the X server (if your system has X11, you may access it using xclip command). If you connect to your shell account using some ssh/terminal emulator software, like PuTTy, you can use the clipboard of the system you are using, but that still would be an external clipboard and you might not be able to avoid using mouse.

What I have found is this little neat bash script, found at http://geek.phatus.com/2010/01/create-a-simple-yet-very-useful-bash-clipboard/ . It basically creates a temporary file which serves as a clipboard - you can clear, execute, write etc. your temporary data using a set of commands, which is actually what a clipboard does ;)

link|improve this answer
the op was just a little bit unclear about his setup: he meant the clipboard of the xserver. – akira Feb 5 '10 at 8:44
feedback

Your Answer

 
or
required, but never shown

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