Bash Navigation Reference (PAL Series)

Update: These were written for my students while my role was a PAL (Peer Assisted Learning) Leader for my course, I intended to keep all the basic/intermediate commands necessary for terminal use in one place to ease the students into using Linux efficiently. I’ve kept them up just in case they’re of use to someone.

Change directory

Navigate to directory in the current directory ( . represents the current directory )

$ cd subDir
#or
$ cd ./subDir

Navigate to a directory in the parent directory ( .. represents the parent directory )

$ pwd
 /home/tom/folder
$ ls
parentDir emptyDir
$ cd emptyDir

$ cd ..           #Change directory to parent
$ cd parentDir
#or
$ cd ../parentDir #Do it all in one go

Navigate to a subdirectory within your home directory ( ~ represents the home directory, the environment variable $HOME also works )

$ cd ~/Downloads
#or
$ cd $HOME/Downloads # You will see this more often in scripts,

Why use $HOME over ~/ in a shell script?

Print current directory

$ pwd             # Print working directory

List contents of the directory

$ ls              # List contents
$ ls -a           # List hidden files
$ ls -l           # Show more info
$ ls ~/Downloads  # Show contents of specific folder

Manual Pages ( very useful )

If you want to find out more arguments/information about the commands we use, look at the man command.
It works with every single linux utility and is often faster to use than Googling it.

$ man ls          # Load the manual page for 'ls', see what other options are available