Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING BASH

Bash pwd - 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.


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.