FactorPad
Faster Learning Tutorials

Linux pwd command summary with examples

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.
Paul Alan Davis, CFA, October 5, 2016
Updated: July 26, 2018
In this tutorial, 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 Next

~/ home  / tech  / linux essentials  / pwd command


The Linux pwd command

Beginner

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

Video Tutorial

Linux pwd command summary with examples (3:18)

Videos can also be accessed from the YouTube Playlist.

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.

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?

  • For the Outline to all 100 tutorials, click Outline.
  • To go back to the less command, hit Back.
  • To learn about viewing directory contents with ls, click Next.

Outline Back Next

~/ home  / tech  / linux essentials  / pwd command



 
 
Keywords:
linux pwd command
pwd linux
linux print working directory
pwd unix
linux current directory
linux directory structure
bash pwd
pwd linux command
pwd stands for
pwd example
man pwd
pwd tutorial