5 ms·
On OS X pbcopy and pbpaste are useful for working with clipboard data. Copy data from a web-page or whatever, manipulate it on the command-line to get what you
by acg 17y ago
On OS X pbcopy and pbpaste are useful for working with clipboard data. Copy data from a web-page or whatever, manipulate it on the command-line to get what you want. Putting reasonably large files in the clipboard can be useful too.
For example:
curl http://news.bbc.co.uk/ | pbcopy # copies a web-page to clipboard
Depending on what you are doing it can be very useful:
pbpaste | sort | pbcopy # sort the contents of the clipboard.
Another useful feature of OS X is open, which uses the finder to open a file:
open file.pdf
open music.mp3
- willwagner 17y agoopen -a finder <dir> is a pretty handy way to open a finder window to current directory.
- zefhous 17y agoYou can just pass the directory, no need to specify finder. open . open /Applications
- rudd 17y agoYou can also specify the app to open using the -a flag and specifying the full name of the app (with correct spacing and capitalization), e.g.: open -a 'TextEdit' foobar.txt open -a 'TextMate' foobar.txt
- zefhous 17y agoI also find it useful to have multiple instances of certain applications sometimes: open -na safari
- antileet 17y agoThe equivalent Linux commands are: # xclip: curl http://example.org | xclip And instead of "open", you can use: xdg-open file.pdf xdg-open music.mpe (or even gnome-open if you're on gnome) will open up the file with their default handler
- makecheck 17y agoAnd "open" works on bundles, allowing you to avoid descending into the /Contents/... part. open /Applications/FooBar.app
- jcromartie 17y agoopen also takes the -a argument to specify which application to use. It's very handy for things like this: alias shop="open -a Adobe\ Photoshop\ CS3"