Linux Filesystem Directory Structure

Unlike other operating systems, in linux everything starts from /. This is called root directory.

You can use cd command to navigate in filesystem. If you’re inside some directory and you want to know where you’re inside the directory tree, just type pwd and it will show you the current working directory. pwd stands for print working directory.

cd command needs some arguments if you want to visit some other directory. By default if you don’t provide it some arguments, it will change the directory to user home directory. If you start a terminal emulator or a virtual console, it starts inside user home directory be default as well.

cd needs a pathname if you want to change directory to some directory inside the filesystem. A pathname is a route to that directory. There are two types of pathnames.

Absolute Pathnames

An absolute pathname starts from root directory /. For example if you want to visit /usr/bin, you type / first. Then the directory name. Absolute pathnames are complete paths starting from / (where filesystem begins) to the file or directory.

Relative pathnames

Unlike absolute pathname, relative pathnames start from current working directory (pwd). If you’re in /var/log directory, and you want to visit journal directory which is a child directory of current working directory, you type cd journal.

If you want to visit the parent directory of current working directory which in this case is /var, just type, cd ../var.

I have a YouTube video tutorial on this topic as well.