In this document, we will discuss the standard directories used in many UNIX-like systems, and how to travel through them.

Note
UNIX is the ancestor of GNU/Linux-based operating systems. Many of the names of these commands were cloned from UNIX. You can read more on the topic here.

Accessing Directories

The Working Directory

A good place to start is with the pwd (*p*rint *w*orking *d*irectory) command. This command prints out what directory we are currently in. To see the name of the working directory, run the following command:

$ pwd

The directory printed out resembles a path. Each word/phrase between each '/' refers to the name of a folder (AKA a directory). When you run a user command, it often completes an operation within the working directory.

Changing Directories

But what if we want to change our directory? Enter the cd (*c*hange *d*irectory) command. Let’s enter the following commands:

$ cd ..
$ pwd

This set of commands changes our directory up one folder, and then prints out the new working directory. '..' represents the parent directory of the working directory.

Listing Contents

So, you know how to travel through directories. The next step would be to see what files are available. To do this, use the ls command. This will list all directories and files within the working directory. Although, there may be more files than shown here. If you want to see all files, run this command:

$ ls -a

Notice two things here:

  • All files starting with a period (.file) are considered hidden files.

  • The symbols '.' and '..' are listed first, and count as virtual directories, where '.' is a shorthand for the current directory, and '..' is shorthand for the parent directory.

Another interesting feature in GNU/Linux is viewing file permissions. If you want to view permissions for directories and files, enter this command:

$ ls -h
Note
Remember than you can view available command options using ls --help or man ls.

Standard Directories

A large majority of GNU/Linux-based systems conform to the FHS (Filesystem Hierarchy Standard). This is a document which defines the purpose and placement of major directories beneath the root directory.