bash copy to clipboard
Scenario: You have written a really handy and useful bash script that does the wonders and parses the world to give you some great bit of information. This script is so useful that you constantly run it all the time. Copy’ing and Pasting the output has become your hobby.
Mac OS X: Let `pbcopy` save you. Just redirect your output to pbcopy (a built in MacOS command) and your contents go into the clipboard, ready for you to paste away. For example,
whoami | pbcopy
will copy the output of the command `whoami` into the clipboard :) Psst. There is something called `pbpaste` as well. And it does, well you guessed it. Have fun.
Linux Users: If you have X installed (I know I lost 75% of the readers right there), `xsel` does the same is a slightly ugly manner.
whoami | xsel —clipboard —input