Message
back to the journal

Opening a Finder window from the Terminal

November 14th, 2007

I stumbled upon a simple method for opening a Finder window at your current Terminal session location recently. Since it is something that I have a regular need for, I thought that there might be other Mac users out there who might also find this useful from time to time.

To set things up so that it is easy to use whenever you need it, you just need to follow these two steps:

First, using your preferred text editor create a file which contains this command:

#!/bin/bash
open /System/Library/CoreServices/Finder.app $PWD

You should name this file with whatever you want to use to call it later. I named it fndr.

Second, you should place this somewhere that is visible on your path. I collect any little utility scripts like this together in a directory called Utils which I added to my path to make all of its contents easily accessible.

Now you can simply type fndr in your Terminal window to open a Finder at your present directory.

If you need help adding something to your path, I recommend creating a file in your home directory (it may even already exist) called .bash_profile. This file gets invoked whenever you enter the Terminal environment.

Add an item to your path by entering a line something like this to your .bash_profile file:

export PATH="$PATH:/Users/PhilH/Utils"

I’m always on the look out for bits and pieces like this to help make my life easier in Mac OSX. Not that I think that things are difficult in this excellent OS, but there is always room for shortcuts to speed up common tasks. If you have any little gems that might be useful to the Mac OSX world, it would be great if you could post them in the comments. Thanks!

4 Responses to “Opening a Finder window from the Terminal”

  1. michael groh,

    simply typing ‘open .’ in the terminal does the same trick… ‘open’ is generally a very usefull command as ‘The open command opens a file (or a directory or URL), just as if you had double-clicked the file’s icon’ (from the man page).

  2. PhilHawksworth,

    Thanks Michael! That’s a helpful tip. I wish I’d discovered it sooner.

  3. links for 2007-11-18 « Simon McManus,

    […] Hawksworx » Blog Archive » Opening a Finder window from the Terminal launch finder from a terminal window (tags: mac) […]

  4. Ali Halai,

    If i login as another user in the terminal, and then type the “open .” command, I get an error msg stating that I do not have sufficient access privileges. this is despite the fact that i am logged into the terminal as that user. Is there any way around this?

Post a comment





Submit your comment

WordPressRSSXHTMLCSS