15 ‘pwd’ (Print Working Directory) Command Examples in Linux

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

13 Responses

  1. David Ecklein says:

    I want to print the filenames in my current directory.

    “pwd” doesn’t seem to print anything.

    what do I do to make it actually print the working directory?

    • Ravi Saive says:


      Do you mean you want to list filenames? then use ls -l command. The pwd only print the current/present working directory location…I hope you get it now.

  2. prasad says:

    Write a shell script for printing all the files related information pwd( eg:size ,permissions

  3. teancum144 says:

    Great tutorial! Above, you make the following comment:
    “If no option is specified at the prompt, pwd will avoid all symlinks, i.e., take option ‘-P‘ into account.”
    However, in Fedora 20, pwd without options defaults to pwd -L.

    • Avishek Kumar says:

      Dear teancum144,
      I would surely like to go through my Fedora 20 Local server to confirm. This is quiet possible. Thanks for your feedback.

  4. Minecraft says:

    Your pwd article could contain so much.
    Thanks for a good article.

  5. Geoff says:

    A few corrections…

    If -L and -P are both used, -L does not have priority; they each override the other (last one wins). Also, for coreutils pwd the default depends on an environment setting. From “info coreutils”:

    “If `-L’ and `-P’ are both given, the last one takes precedence. If
    neither option is given, then this implementation uses `-P’ as the
    default unless the `POSIXLY_CORRECT’ environment variable is set.”

    As far as I know the shell built-in versions of pwd in all the POSIX-type shells (bash, dash, ksh, etc.) follow the POSIX requirement of defaulting to -L.

    The /usr/include/pwd.h header is unrelated – it provides the API for accessing /etc/passwd (or network equivalents).

  6. djf says:

    Never thought your pwd article could contain so much – especially liked the tie in with the “type” command – which I should have known but did not.

    Thanks for a surprisingly good article.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.