How to read and write a filepath

How to read and write a filepath
Mac Tip #513, 23 November 2011

Every file and folder on your Mac has a unique ‘address’ — its filepath. It’s easy to understand and read them, once you know how. Learn how to read filepaths here.

Quick Start

  1. Start with the hard drive name as the base and then name each file or folder, becoming more specific. Separate each item with a slash:
    Macintosh HD/Users/miraz/Sites/runspotrun/
  2. Use a slash by itself to refer to the Root Directory:
  3. Use a tilde as a shortcut to refer to the Home Directory:

Want more detail? Read the full Tip below.

Related Tips

In Open and Save can be easier I mentioned using a shortcut in an Open or Save dialog box. That shortcut relies on understanding filepaths. Here’s what you need to know about the path of a file.

Find a file

If you open a new window in the Finder you should see a bunch of files. They might be in your Documents folder, for example. The screenshot shows part of my Documents folder. You will surely have different things in your Documents folder.

My Documents folder.

My Documents folder.

Some of the items in my Documents folder are files, while others are folders that may contain more folders or files or both.

If you look at the bottom of the Finder window in the screenshot, you’ll see the filepath for my Documents folder:
Macintosh HD — Users — miraz — Documents.

Yours should be the same, except instead of miraz it’ll have your username.

If you don’t see the filepath at the bottom of a Finder window on your Mac read View the Path of a File.

File paths and slashes

Although in these Tips I commonly use dashes or arrows to show that a file or folder is inside another, a more conventional way of writing a filepath is to use slashes to separate the items, like this:

That filepath shows that the Documents folder is inside the miraz folder, which in turn is inside the Users folder. The Users folder is on the Hard Drive which is named Macintosh HD.

Directories and folders

Sometimes folders are called directories. Both refer to the same thing.

The Root Directory

When a brand new Mac comes from the factory its hard drive is usually named Macintosh HD. That’s what’s known as the Root Directory. Sometimes, especially if you’re writing out or referring to the root directory you can refer to it with just a slash: /.

Make sure you use the forward slash at the bottom of the keyboard near the letter M and not the backslash above the Return key, near the square brackets.

Folders in the Macintosh HD root directory.

Folders in the Macintosh HD Root Directory.

The single slash at the start explains the filepath above: /Users/miraz/Documents. It starts with a slash, so it’s saying that the Users directory (or folder) is directly inside the Macintosh HD directory.

The Root Directory usually has certain folders in it:

  • Applications
  • System
  • Library
  • Users.

It may have a few other items, as mine does as you can see in the screenshot, but it definitely should have those 4 folders.

The Home Directory

Your Mac has certain Users. You are one of them. On my Mac I’m the User called miraz.

The Home folder for a User is marked with a house icon when they are logged in.

The Home folder for a User is marked with a house icon when they are logged in.

All the Users have their own named folder inside the Users folder. The main folder for a particular User is called their Home folder.

The tilde character

Tilde key.

Tilde key.

Just as a slash (/) is a shortcut for referring to the Root Directory, so the ~ (tilde) character is a shortcut for referring to the Home Directory for the User who is currently logged in.

Can’t find the tilde key? It’s at the extreme top left of the keyboard, just to the left of the number 1. To type a tilde hold down Shift (⇧) and type the key above the Tab and to the left of the 1.

A couple of examples

Go to the folder shortcut.

Go to the folder: shortcut.

In the screenshot above I’ve typed /Users/miraz/Sites/runspotrun/. This represents the filepath for the folder named runspotrun in the Sites folder in my Home Directory.

Go to a folder nested inside my Home Folder.

Go to a folder nested inside my Home Folder.

Another way to type that same filepath is to use the tilde shortcut to represent my Home Folder: ~/Sites/runspotrun/.

Of course, you could always write it out the long way too: Macintosh HD/Users/miraz/Sites/runspotrun/

Quickly go to a folder in the Finder

Let’s say you’re in the Finder and want to quickly get to a folder perhaps buried deep in the system.

  1. Type Command (⌘) Shift (⇧) G. A small text box opens up like the ones in the screenshots above.
  2. Type in the filepath for the folder you want to get to.
  3. Click the Go button. The folder whose path you entered opens in a Finder window.

Nifty, eh!

Now combine that with some TextExpander macros and you can zip around your folder system with ease.

Comments please

I love your comments — they help me know what to write about and they help other readers too. Please visit the website and leave your comments on this Tip there.

And please remember to tweet about the Tips, mention them on Facebook, like our MacTips Facebook page and generally share the Tips around. The main site gets around 98,000 page views per month, and I’m hoping to get over 100,000 this month if I can!

Credit where it’s due

This Tip was written by Miraz Jordan,, and is available under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

Related posts

[wpzon keywords="pressure cooker" sindex="PCHardware" snode="1232597011" sort="salesrank" listing="8"]