Skip to content

The pwd command

The pwd command prints the full path of the directory you are in…

The pwd command prints the full path of the directory you are in, starting from the root, /.

Taught in Beginner, lesson 1

A practice shell in your browser that behaves like bash on Linux for these commands. Nothing you type leaves the page.

Usage

pwd

Print the current (working) directory. Prints the absolute path of the directory you are in, starting from the root, /.

How to use pwd

See where you are

The prompt shows a short form (~ for home); pwd prints the whole path.

pwd
/home/learner
cd projects/app && pwd
/home/learner/projects/app

Questions about pwd

What does pwd stand for?

Print working directory. The working directory is the folder commands use when you give them a name without a path.

What is the difference between pwd and $PWD?

They hold the same path. $PWD is a variable the shell keeps up to date, so you can use it inside other commands, as in echo $PWD.

Learn it step by step

Every everyday command on one page, to print or keep open: the Linux commands cheat sheet.