Linux Terminal Command: pwd
The pwd command is an essential tool in Foundations & Navigation. In this tutorial, we will explore what pwd does, look at everyday examples, and cover advanced options to supercharge your command-line workflow.
Concept & Explanation
The pwd command prints the absolute path of the current directory. It is essential for checking your path location before executing destructive commands.
Common Options & Syntax
pwd [options] [arguments]
Here are the most common flags used with pwd:
- Simple Usage: Basic default commands.
- Detailed View: Shows diagnostic information.
- Advanced Actions: Can chain parameters for scripting.
1. Interactive Example (Simple)
Here is how most people run the command:
# Example
pwd
What it does: Prints the absolute path of the current working directory.
2. Power-User Example (Advanced)
For scripting and advanced diagnostics, use this configuration:
# Advanced
pwd -P
What it does: Prints the physical directory path, resolving any symbolic links to their real source paths.
⚙️ Warning & Common Pitfalls
[!WARNING] By default,
pwdresolves paths logically (-L), which means it shows symbolic links rather than the actual physical directory paths on the disk.
🔗 Related Commands
Here are some related posts on cli_tty1 you might want to check out:
- which : Locate a command in the user path environment.