As a Unix-based system, Linux has a unique file system layout compared to Windows. Understanding how to navigate directories and manage files is essential for working on the command line. In this article, we cover the basics of file system navigation using pwd, ls, and cd.
Linux uses a single hierarchical tree to manage files. Unlike Windows, where each storage drive has its own file system (C:, D:, etc.), Linux mounts all devices into a unified directory tree rooted at /.
The pwd command shows your current location in the file system:
pwd
/home/userUse ls to list the contents of the current directory:
ls Desktop Documents Downloads MusicTo move between directories:
cd /usr/bin
pwd
/usr/bin/ and follows full directory hierarchy.| Symbol | Meaning |
|---|---|
. | Current directory |
.. | Parent directory |
Move from /usr/bin to /usr using both styles:
cd /usr # absolute
cd .. # relativeMove from /usr to /usr/bin:
cd /usr/bin # absolute
cd bin # relative (from /usr)., shown via ls -aFile1 ≠ file1_) instead| Shortcut | Action |
|---|---|
cd | Go to current user's home directory |
cd - | Return to previous directory |
cd ~username | Navigate to another user's home |
Linux provides a powerful and flexible directory structure. Understanding how to use pwd, ls, and cd—along with absolute and relative paths and filename conventions—will help users navigate the system efficiently and confidently.