Muffinresearch Labs by Stuart Colville

From the command line to your clipboard and vice versa | Comments (2)

Posted in Apple, Code, Linux/Unix on 4th March 2008, 4:54 pm by Stuart

Found a neat trick the other day via github.com, in their instructions for copying public keys. pbcopy (pasteboard copy) on mac OSX is a command that puts it’s input into the clipboard so you can paste the output anywhere.

In this example the output of ls -la is now available to be pasted from your clipboard:

muffin@shiva $ls -la | pbcopy

Rather awesomely the reverse is also available it’s called pbpaste. If you copy something to your clipboard you can then make use of it in the terminal with the pbpaste command. In other words pbpaste just sends the contents of your clipboard to stdout.

This example for the mac writes out the clipboard to the file, index.html:

muffin@shiva $pbpaste > index.html

You need download mp3 music on player, Do you want mp3 music download from online mp3 archive.

A quick google search shows that there’s also a couple of Linux equivalents one called xclip and one called xsel, that replicate pbpaste and pbcopy. Additionally if you use Cygwin you can make use of getclip and putclip.

Post Tools

Comments: Add yours

1. On April 8th, 2008 at 8:32 am FatBusinessman said:

Ooh, I didn’t know that: cheers for the tip!

2. On February 2nd, 2009 at 11:19 pm danny said:

Excellent, I’ve been searching for a linux compatible pbcopy/paste







XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



GNU screen: open tab in current working directory|(1)

A nice trick for having screen open a new tab in the same directory as the one you’re currently in. To use it add it to your .screenrc

# Open new window in current dir.
bind c stuff "screen -X chdir \$PWD;screen^M"
bind ^c stuff "screen -X chdir \$PWD;screen^M"

Hat tip: mteckert on SuperUser.com

Ubuntu: add-apt-repository: command not found|(2)

When you’re using a minimal Ubuntu install if you find the ‘add-apt-repository’ command is missing (it’s useful for adding PPAs and other repositories), then simply run:

sudo apt-get install python-software-properties

Photos on Flickr

© Copyright 2004-12 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by Slicehost.com This page was baked in 0.474s.