일. 7월 27th, 2025

Introduction

If you’re new to Linux, navigating the terminal can feel overwhelming. One essential command that helps you stay oriented is pwd. This simple yet powerful tool tells you exactly where you are in the Linux filesystem—like a GPS for your terminal! Let’s break down how it works.


What Does “pwd” Stand For?

pwd means Print Working Directory. It displays the full path of your current directory (folder) in the terminal. Think of it as asking, “Where am I right now?” in the filesystem maze.


Why Use pwd?

  • Avoid confusion: When you’re deep in nested folders, pwd shows your location.
  • Reference paths: Copy the output to use in scripts or other commands.
  • Troubleshooting: Verify your location before running critical operations.

How to Use pwd: Basic Examples

1. Basic Usage

Open your terminal and type:

pwd

You’ll see something like:

/home/yourusername/documents

2. Using Flags

  • -P (Physical Path): Shows the “real” path, ignoring symbolic links (shortcuts).
    Example: pwd -P
  • -L (Logical Path): Default behavior. Shows the path as you navigated it, including symbolic links.
    Example: pwd -L

Visual Example: pwd in Action

Imagine this directory structure:

/home/
  └── user/
      ├── documents/
      └── downloads/

If you’re in documents, running pwd displays:

/home/user/documents

Terminal showing the pwd command output
(Example output of the pwd command)


Common Mistakes & Tips

  1. Typos: Ensure you type pwd in lowercase.
  2. Confusing with ls: ls lists folder contents; pwd shows your location.
  3. Symbolic links: Use pwd -P if a path looks “wrong” due to shortcuts.

Practice Exercise

  1. Open your terminal.
  2. Navigate to a folder using cd (e.g., cd documents).
  3. Run pwd.
  4. Now, use cd .. to move up one level and run pwd again.
    See how the path changes?

Key Takeaways

  • pwd = Print Working Directory.
  • Always use it to confirm your location.
  • Combine with cd and ls for efficient navigation.
  • Flags like -P handle symbolic links.

Mastering pwd is your first step toward Linux confidence! 🐧

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다