Copy Shell Output via the Command Line
Oftentimes I'll want to copy the output of a shell command execution but can't get the whole output because it's larger than the terminal's buffer length, so I'll need to write to file for easy viewing, or I'll simply be annoyed that I have to click-hold-drag to copy the output. Shouldn't there be an easier way? There is: pbcopy and clip. Using pbcopy within the shell, the output of an execution can automatically be added to the copy queue (or clipboard):
# Copy the source of davidwalsh.name to the clipboard on Mac
curl davidwalsh.name | pbcopy
# Copy the source of davidwalsh.name to the clipboard on Windows
curl davidwalsh.name | clip
Piping pbcopy at the end of the command makes this magic possible. So what do I look forward to using this for? My colleague Luke showed me how he gets the commit hash from the master branch without needing to go to GitHub to get it:
alias ghash='git rev-parse HEAD && git rev-parse HEAD | pbcopy'
I look forward to using pbcopy more -- an excellent utility to allow me to avoid lame cursor click-hold-drag to get the output I want!
With Firefox OS, asm.js, and the push for browser performance improvements, canvas and WebGL technologies are opening a world of possibilities. I featured 9 Mind-Blowing Canvas Demos and then took it up a level with 9 Mind-Blowing WebGL Demos, but I want to outdo...
One of my favorite social APIs was the Open Graph API adopted by Facebook. Adding just a few META tags to each page allowed links to my article to be styled and presented the way I wanted them to, giving me a bit of control...
I released my first MooTools class over a year ago. It was a really minimalistic approach to zebra tables and a great first class to write. I took some time to update and improve the class.
The XHTML
You may have as many tables as...
One of the most awesome parts of the Dojo / Dijit / DojoX family is the amazing GFX library. GFX lives within the dojox.gfx namespace and provides the foundation of Dojo's charting, drawing, and sketch libraries. GFX allows you to create vector graphics (SVG, VML...
It may be silly to notice that this isn’t for Windows…
Might be worth adding instructions using
xcopy
on Linux, andclip
on WindowsI am on Linux and I use http://www.vergenet.net/~conrad/software/xsel/
Use it like this:
curl davidwalsh.name | xsel –clipboard –input
You can also alias is so you can use pbcopy
To do that add alias pbcopy=’xsel –clipboard –input’ to your ~/:bashrc
windows would be curl davidwalsh.name | clip
assuming you had curl for windows installed ;)