2.2.1 Directory Operations
Directories organize files into a structured hierarchy.
Understanding how to navigate and manage directories is essential for working efficiently in Linux.
Viewing the Current Working Directory
At any moment, the system keeps track of a current working directory.
Many commands operate relative to this location.
Knowing where you are in the file system helps prevent mistakes.
Listing Directory Contents
Directories can be displayed in different formats to show:
- File names
- Permissions and ownership
- Hidden files
Different listing styles provide different levels of detail, depending on your needs.
Navigating with Relative and Absolute Paths
Linux allows navigation using:
- Absolute paths, which start from the root directory
- Relative paths, which start from the current directory
Understanding the difference makes navigation faster and more predictable.
Creating and Removing Directories
Directories can be created to organize files logically.
Empty directories can be removed safely, helping keep the file system clean.
📌 Tip:
Always be aware of your current directory before performing directory operations.