Pathnames

Each directory and file in the file system has a specific location on the file tree. That location is called the pathname, which you can think of as a street address. Pathnames allow you to specify where you want to put files and help you find your location on the file tree.

How Pathnames Work

All absolute pathnames start from the root directory (/) and work their way through each branch of the file tree from the root directory to the file or directory that you wish to identify. A slash / is placed between each level in the path name to separate each directory name from the previous level. Each file or directory has a unique path name.

Example:

Joe Shmoe’s Home Directory

Locating Joe Shmoe's Home Directory in AFS: /afs/unity.ncsu.edu/users.j.jschmore
A visualization of locating user jshmoe‘s home directory
(/afs/unity.ncsu.edu/users.j.jschmore)

Linux File Names

  • Up to 256 characters long
  • No special characters: | { } [ ] ( ) ! & * ? \ ^ % @ # ” ‘ `<>
    • FYI (advanced): If you must use a special character, precede it with a backslash (‘\’). For example, to name a file “some!file”, you may have to name it “some\!file” for it to function correctly
  • Cannot include the forward slash (‘/’)
  • Should not include spaces (follows the special characters rule). To separate words, it is advised to use an underscore (_), like_this