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/user
Use ls
to list the contents of the current directory:
ls Desktop Documents Downloads Music
To 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 .. # relative
Move from /usr
to /usr/bin
:
cd /usr/bin # absolute
cd bin # relative (from /usr)
.
, shown via ls -a
File1
≠ file1
_
) insteadShortcut | 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.