Wednesday, January 23, 2008
Leopard Spots: Paste from Finder to Terminal
Actually, I don't know if this is a new Leopard thing or not, but it's massively useful. The other day, I needed to move some JAR files from one place to another, and I already had my trusty terminal window open on the destination directory. I wasn't sure which ones I needed in the giant pile in the source directory, so a wildcard expedition in Quicksilver didn't seem like the right way to go. So, I went to Finder and visually sighted the 4 files I needed. Wouldn't it be nice if I could just copy and paste them into the terminal? Why not try? So I did. Now, it didn't copy the files, but it did give me fully qualified path names to each of the files, separated with a space. A quick "cp" added to the front and an " ." added to the end, and they're copied. I don't know if Finder has always allowed you to copy and paste fully qualified file names, but it sure does now.
Subscribe to:
Post Comments (Atom)
8 comments:
Nice find.
> but it sure does not.
should be:
but it sure does now.
Didn't know that. Thx. Btw. I just tested it on Tiger and it works there too.
I only recently discovered this just like you did. It seems to work with Terminal or iTerm. I also checked it on Linux, and it seems to work as well for both GNOME and Xfce.
As an alternative, you can also drag and drop a file or list of files to the Terminal window; the file names are pasted in just as if you had copy and pasted.
You can also do something like
cp `pbcopy` .
You can also drag files from finder to the file upload fields in web forms in Safari. Somehow it just occurred to me the other day and I knew before I even had tried it that it will work.
you could also access the clipboard from the commandline, using pbpaste and pbcopy.
e.g. Coping the current working directory to the clipboard:
% pwd | pbcopy
OSX continues to amaze me daily. I just want to give a BIG thank you to Gates co. for releasing Vista. If they hadn't dropped that steaming pile of code I would have never had the impetus to switch.
Post a Comment