Free scripts to improve UNIX/Finder interaction

Sep 22, '03 08:53:00AM

Contributed by: wgscott

Have you ever wanted to open a Terminal (or iTerm) immediately into the same directory displayed in the OS X Finder window?  You can do this and much more using Gary Kerbaugh's collection of UNIX utilities and Applescripts. Three shell scripts allow greatly increased synergy between the Finder and the command line. These can be supplemented with AppleScript applications that allow you, in one click, to open a Terminal window or iTerm tab in the directory corresponding to that shown in the finder.

These unix utilities include cdf, posd, fdc and rmm.

cdf and posd:
posd is an osascript embedded in a shell script that returns the directory corresponding to the frontmost Finder window.  Its real value is when aliased to the command cdf, i.e.:

 % cdf='cd "$(/sw/bin/posd)"'
The command cdf changes the terminal working directory to match that of the frontmost Finder window.

fdc:
fdc is essentially the reciprocal operation of cdf.  It changes the Finder window to match the current directory of the Terminal in which the command is issued.

rmm:
rmm is a shell script (also written by Gary; info/download) that emulates the GNU rm function, except that it moves files to the user's Trash directory, instead of unlinking them.   If you alias rm to rmm for your interactive sessions (only), then it can become a rm replacement that puts everything in the Trash can, much like Finder's delete.

I've put further details, including links to Finder toolbar applications, downloads, screenshots, fink ports and a few of my modifications on my website...

Comments (12)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030915193326598