Search⌘ K

Dot and Double Dots

Explore how to navigate your filesystem using the dot (.) and double dot (..) shortcuts in the command-line interface. Learn to move between current, parent, and higher-level directories quickly using relative and absolute paths. Practice switching efficiently between directories with commands like cd - to enhance your navigation skills.

Using . and ..

Two shortcuts help us work with files and directory paths when working on the command line: the dot (.) and the double dot (..).

Switch to the /var directory and use the ls -alh command to get a list of the files in the current directory, including the hidden ones:

$ cd /var
$ ls -alh

Take a look at the top two entries in the listing. Run the commands on the terminal below.

Terminal 1
Terminal
Loading...

The first entry is a dot (.). It represents the current directory. The second entry, the double dot (..), represents the directory that contains the ...