Skip to main content
In this lesson you’ll learn the foundational concepts needed to create, delete, copy, and move files and directories in Linux. Before performing those file operations, it’s important to understand the file system layout and how the shell interprets paths. Key concepts covered here:
  • What the Linux file system tree is
  • The difference between absolute and relative paths
  • How to list files and interpret ls output
  • How to view and change your current working directory

Listing files and directories

To list files and directories — including hidden ones (names beginning with a dot) — use:
  • -a shows all entries (including . and .. and files that start with .).
  • -l uses the long listing format (permissions, owner, group, size, modification time).
Example outputs:
A simple ls -a shows hidden entries alongside visible ones:
To list files in another directory, supply the path to ls, for example:
Combine flags such as -l (long), -a (all), and -h (human-readable sizes) to get a detailed, readable listing:
Example:
Flags can be combined in any order: ls -alh, ls -lha, and ls -hal are equivalent. Use whichever ordering you find easiest to remember.

Callouts

Hidden files in Linux begin with a dot .. Tools and configuration files (like .bashrc) are commonly hidden to avoid cluttering normal directory listings.

Quick command reference

The Linux file system tree

Linux organizes everything under a single top-level root directory: /. This creates an inverted tree structure where every file and directory stems from /. Common top-level directories include /home, /var, /etc, /usr, and /root. User home directories live under /home (for example, /home/aaron).

Absolute paths

An absolute path always begins at the root / and specifies the full route to a file or directory. Example:
This path begins at /, then moves to home, aaron, Documents, and finally the file invoice.pdf.

Current directory and relative paths

Your shell session always has a current working directory. To display it, use:
Example:
Use cd to change directories. Examples:
A dark-themed screenshot showing a terminal pane alongside a filesystem tree titled "Current / Working Directory." The diagram shows root (/) branching to folders like home, var, and root, with user directories (aaron, jane) under home and aaron containing Documents and an Invoice.pdf.
Relative paths are interpreted from your current working directory. If your current directory is /home/aaron, here are common ways to reference files:
  • Descend into a subdirectory:
    • Documents/invoice.pdf → /home/aaron/Documents/invoice.pdf
  • Refer to a file in the current directory:
    • invoice.pdf → /home/aaron/invoice.pdf
  • Refer to a file in the parent directory:
    • ../invoice.pdf → /home/invoice.pdf (one level up)
You can chain .. segments to go up multiple levels, for example ../../otherdir/file.txt moves up two directories before descending into otherdir.

Additional tips

  • cd / takes you to the root directory (/).
  • cd - switches back to your previous working directory.
  • cd with no arguments returns you to your home directory (e.g. /home/aaron).

References and further reading

Watch Video

Practice Lab