Skip to Content
This project is a work in progress. If you have any questions or suggestions, feel free to contact me.
LinuxFile SystemFile System Paths

File System Paths.

File system paths are essential for navigating and managing files in Linux. They can be categorized into two main types: absolute paths and relative paths.

Absolute Path

  • Starts from the root / directory.
  • Describes the full location of a file or folder.

Example:

cd /home/user/Documents

This takes you directly to the Documents folder of user.

Relative Path

  • Relative to the current working directory.
  • Doesn’t start with /.

Example:

cd Documents/Reports

This navigates to Documents/Reports assuming you’re currently in /home/user.

Special Path Symbols

SymbolMeaning
.Current directory
..Parent directory
~Home directory of the current user
-Previous working directory
  • cd Command – Change Directory

Syntax:

cd [directory]

If no argument is given, it goes to the user’s home directory.

Chain with relative path
cd /home/user/Documents cd ../Pictures pwd

Output:

/home/user/Pictures

Tip: Tab Completion

When using cd, press Tab to auto-complete directory names:

cd /var/lo<Tab>

It auto-completes to:

cd /var/log

Common Errors

Directory doesn’t exist
cd /nonexistent/path

Output:

bash: cd: /nonexistent/path: No such file or directory
Permission denied
cd /root

Output (as non-root user):

bash: cd: /root: Permission denied
  • pwd: Print working directory.
  • ls: List contents of a directory.
  • ls -l: Long listing with permissions and timestamps.
Last updated on