FactorPad
Build a Better Process

Linux pwd Command Summary with Examples

Linux pwd allows you to print the name of the current directory.
  1. Purpose - Learn what pwd is for and how to find help.
  2. Options - Review a few common options and arguments.
  3. Examples - Walk through code examples with pwd.
  4. A tip - Finish off with one more insight.
face pic by Paul Alan Davis, CFA
Updated: February 23, 2021
In this tutorial on Linux pwd, 6 of 100, below find a 3-4 minute introductory video, a text-based tutorial and all of the code examples from the video.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / pwd-command.html


An ad-free and cookie-free website.


Examples of the Linux pwd Command

Beginner

Learn to view the directory location at the Linux command line.

Video Tutorial

Videos can also be accessed from the Linux Essentials Playlist on YouTube.

Linux pwd Command Summary with Examples (3:18)

Video Script

The Command and Why You Need It

Our sixth word, or command to memorize is pwd from the category Navigation.

pwd allows you to print the name of the current directory, sometimes called the working directory. It's always a good idea to know where you are, right? And pwd will tell you where you are in the computer's directory structure.

Common Linux pwd Options
-options description
--help Print help on the pwd program
--version Print the version of pwd

If it helps, think of commands as mini programs and most have this structure. First, type the command, second the -option(s) and third the argument(s).

The pwd command has 4 options and no arguments, meaning the current directory is assumed and you don't need to enter it.

For now, we'll skip the options because they are rarely used, but you can use the man command from video 4 if you are curious.

So why is pwd an important command? Well, it is easy to get lost in the maze of a file structure, so pwd helps you find exactly where you are. And now you know how to do that.

Demonstration

Okay, the best way to embed this in your memory is by typing in your own terminal window.

Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows 10.

Here we go, type pwd and Enter for the directory name and path from the starting point, or root, as they call it.

$ pwd /home/paul $

It helps to visualize the directory structure on Linux as a tree, and the root is the name given to the base, or starting point. It is depicted with the forward slash. In that we have the home directory and within that is a directory called paul, which is my own private directory. We'll explore this structure in future videos.

A Final Tip

Okay now you know how to use pwd. And you know the syntax for commands, options and arguments.

One last tip about the pwd command. Later we will see how to use permissions to keep others' eyes out of your directory.

Okay, thanks for visiting today. I hope this was a fun introduction to the pwd command.


Learn More About The Series

For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:


What's Next?

There's a lot to learn on the FactorPad Channel, why not subscribe and follow for reminders?

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / pwd-command.html


Linux pwd command
pwd linux
linux pwd examples
pwd command
unix pwd
pwd unix
linux current directory
linux pwd examples
bash pwd
man pwd
print working directory
current working directory
pwd linux command
pwd stands for
pwd example

A newly-updated free resource. Connect and refer a friend today.