Navigating directories and listing their contents are fundamental skills when working with the Linux file system. These operations allow users to explore the structure of the system, locate files, and perform essential management tasks.
Linux provides simple but powerful commands to understand the current location within the directory tree, change directories, and display directory contents with varying levels of detail.
The pwd (print working directory) command displays the full path of the directory you are currently in. This command helps you maintain orientation within the Linux file system, especially when navigating deep directory trees.
Example:
$ pwd
/home/username/DocumentsThis output tells you that your current location is the Documents folder inside the user's home directory.
The ls command lists all files and subdirectories within the current directory or a specified path. By default, it provides a simple list but comes with many options to customize the output.
Common options:

Example:
$ ls -lahThis command gives a long listing of all files (including hidden), with human-readable file sizes.
The cd (change directory) command moves you to a specified directory. You can specify the path as relative or absolute.
Key points:
1. cd /path/to/directory: Absolute path navigation from root (/).
2. cd directory_name: Relative path from the current directory.
3. cd ..: Move up one directory level.
4. cd -: Switch to the previous directory.
5. cd (alone): Returns to the user's home directory.
6. cd ~username: Goes to another user’s home directory.
Example:
$ cd /var/log
$ pwd
/var/log
$ cd ..
$ pwd
/varUsers often combine navigation with listing to efficiently explore the file system.
For example:
$ cd /etc
$ ls -l
We have a sales campaign on our promoted courses and products. You can purchase 1 products at a discounted price up to 15% discount.