Directories, Files, and Path Names
In Unix, folders are called directories. Files are still files. The location of a file is called its path. The very top folder (or bottom folder depending on how you think about it) is called the root directory. This root directory is the one you see when you double click your hard drive. It contains the Applications, Library, System, and Users folders.
Here is how you refer to various parts of the file system in Unix:
- The forward slash (
/) refers to the root folder. - A path name beginning with a slash (
/) is an absolute path. For example, the path/Applicationsrefers to the Applications folder, no matter where you currently are. To see a list of Applications, typels /Applications. It doesn’t matter where you currently are because it’s an absolute path. - A path name beginning without a slash is a relative path. For example, if you are currently in your Home folder, the path
Documentsrefers to the Documents folder under your Home folder. While in your Home folder, typels Documentsto see a list of your documents. If you were to typels Applications(without the slash), you’d likely see an error since you (probably) don’t have an Application folder inside your Home folder, and the path is relative to where you currently are. - The tilde (
~) refers to your Home folder. (It’s also an absolute reference, despite not having a preceding slash.) To see what’s in your Home folder, typels ~. To see your own Documents typels ~/Documents. It’s an absolute reference that works from anywhere. For me, the path/Users/richard/Documentsis the same as~/Documents. - You can use the tilde with someone else’s username to refer to their Home folder. For example, to see what’s in Mary’s Home folder, type
ls ~maryor to see what’s in John’s Documents folder, typels ~john/Documents.
You should now be able to refer to any path on your hard drive. Did I leave anything out?

October 13th, 2006 at 6:37 pm
You might want to mention that Folder names with spaces or other special characters in them need to be handled with care. Putting a backslash in front a space or special character will suffice in most cases:
Folder: Users -> Brian -> My Stuff -> Brian’s Pics
Directory: /Users/Brian/My\ Stuff/Brian\’s\ Pics
October 13th, 2006 at 11:37 pm
Two more things to keep in mind are the ‘.’ and ‘..’ for directories.
When using one period, as in cd ./Music, you are referring to the current directory. In my head, I think of it as ‘here’, so ‘here slash Music’ would refer to the Music directory under the current working directory. This is a relative path.
When using two periods, as in cd .., you are referring to the parent directory, ie the directory above the one you are currently in. So if I were in my home directory, /Users/nathansweeney, typing ls -l .. would list files and directories in the /Users directory. Or cd ../.. would change directory up one, then up one again, so up 2 directories from where you were.
And, don’t forget the pwd command to show your present working directory if you get lost in the file tree.