Linux Command Line Basics Part II: Navigation

Knowing basic *nix terminal commands is an absolute must for any computer pro. Whether you use Windows, Mac OS or Linux, you’re bound to face the command prompt at some stage, so here’s my crash course in CLI. Part 2 covers some basic commands for navigating the file system.



‘pwd’ stands for ‘print working directory’, also known as the ‘where the hell am I?’ command. Depending on the default shell running on your machine, you may not have any information about your whereabouts in the file system, which is where ‘pwd’ comes in. pwd will print the current (‘working’) directory on a new line.

pwd in action


‘ls’ lists the contents of a directory. It is akin to Windows’ ‘dir’ command. As with many Unix commands, ‘ls’ can accept options to alter the format of its output. One of the most useful options for ‘ls’ is ‘l’ ($ ls -l), which prints the contents of a directory along with the permissions and ownership information for each file.

By default, ‘ls’ will list the contents of the current directory, however it is possible to find out about other directories by specifying their path, for example ‘$ ls /Users/randymarsh/‘.

Listing directory contents with the '-l' option

cd & ..

The ‘cd’ command is used to change the working directory (‘cd’ stands for ‘change directory’). Using cd, you can navigate between any two points in the file system. In the example below, the user navigates from ‘/dev‘ to ‘/bin‘ using the cd command.

One of the most common options used with cd is ‘..’. .. specifies the parent directory and can be used to target a parent directory as an option for any command which takes a file path as an argument. In the example, the user navigates from ‘/bin‘ to its parent directory (‘/‘) using ‘..

If you want to move two directories above the current working directory, you can use .. multiple times, for example ‘$ cd ../../home

Typing cd with no options switches the working directory to the home directory of the current user, which is another very useful function.

Navigating the file system using cd

In the next section of the guide, we’ll start creating and manipulating files.

For a full list of topics covered in this tutorial series, head over to theĀ index page.

One Response to “Linux Command Line Basics Part II: Navigation”

  1. […] next part of this guide covers some basic navigation […]

Leave a Reply