Navigation commands are used to move between directories and view files in the Linux filesystem.
The most important navigation commands are:
- pwd → Show current directory
- ls → List files and directories
- cd → Change directory
These commands are used daily by:
- Linux administrators
- DevOps engineers
- Developers
- Cloud engineers
1. pwd Command
Meaning
pwd = Print Working Directory
Shows the current directory path.
Syntax
pwd
Example
/home/aryan/projects
This means:
- Current location is projects directory.
2. ls Command
Meaning
ls = List directory contents
Shows files and folders.
Basic Syntax
ls
Example
file1.txt
script.sh
projects/
Important ls Options
| Command | Purpose |
|---|---|
| ls -l | Long listing format |
| ls -a | Show hidden files |
| ls -lh | Human-readable sizes |
| ls -lt | Sort by modified time |
| ls -R | Recursive listing |
Long Format
ls -l
Output shows:
- Permissions
- Owner
- File size
- Modification date
DevOps Example
ls /var/log
View log files.
Kubernetes Example
ls ~/.kube
View Kubernetes config files.
3. cd Command
Meaning
cd = Change Directory
Used to move between directories.
Syntax
cd directory_name
Examples
Move into Directory
cd projects
Move to Absolute Path
cd /var/log
Move Back One Directory
cd ..
Move to Home Directory
cd
or
cd ~
Move to Previous Directory
cd -
Very useful in server administration.
Relative vs Absolute Paths
Absolute Path
Starts from /
Example:
cd /etc/nginx
Relative Path
Starts from current location.
Example:
cd projects/backend
Top comments (0)