bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
Learn/Bash/Basic Commands
Bash•Basic Commands

Bash pwd Command - Print Working Directory

Using the pwd Command

The pwd command shows you the full path of the folder you're currently in.

Basic Usage

To see the full path of the current folder, just type pwd :

Example

pwd
/home/user/my_directory

Options Overview

The pwd command supports a few options to customize its output:

  • -L : Display the logical current working directory
  • -P : Display the physical current working directory (without symbolic links)

-L Option: Logical Path

The -L option shows the logical path, including any symbolic links.

This is the default behavior of pwd .

Example: Logical Path

pwd -L
/home/user/my_directory

-P Option: Physical Path

The -P option shows the physical path, resolving any symbolic links to their actual locations.

This is useful when you need to know the exact physical directory structure.

Example: Physical Path

pwd -P

Why Knowing Your Current Directory is Important

Knowing which folder you're in is important when moving around the filesystem. It helps you make sure you're in the right place when running commands that use relative paths.

Common Use Cases for pwd

  • Running Scripts: Make sure your script is using the right files and folders.
  • Managing Files: Check where you are before copying or moving files to avoid mistakes.
  • Fixing Problems: Knowing your current folder can help you solve path-related issues.

Previous

Bash cd - Change Directory

Next

Bash echo Command - Display Text

This chapter

Overview
13

Lessons

31m

Read time

1. Bash Commands Overview2. Bash ls Command - List Directory Contents3. Bash cd - Change Directory4. Bash pwd Command - Print Working Directory5. Bash echo Command - Display Text6. Bash cat Command - Concatenate and Display Files7. Bash cp - Copy Files and Directories8. Bash mv Command - Move or Rename Files9. Bash rm Command - Remove Files or Directories10. Bash touch Command - Change File Timestamps11. Bash mkdir Command - Make Directories12. Bash man Command - User Manual13. Bash alias

On this page

Using the pwd CommandBasic UsageOptions Overview-L Option: Logical PathExample: Logical Path-P Option: Physical PathExample: Physical PathWhy Knowing Your Current Directory is ImportantCommon Use Cases for pwd