Finding Yourself with pwd

As you begin using Unix and start moving around in directories and files, you’re likely to get a bit lost—that is, forget which directory or subdirectory you’re in. You can use the pwd command to get a reminder of where you are, as shown in Code Listing 1.5.

Code Listing 1.5. pwd displays the name of the current directory, which is particularly handy if you’ve been exploring the system. By combining commands, you can request the directory’s name and contents at one time.
[jdoe@frazz jdoe]$ pwd
/home/jdoe
[jdoe@frazz jdoe]$ ls ; pwd codelisting1.2 codelisting1.4 mail/ → public_html/ testlink@ codelisting1.3 limerick Project/ testfile → tmp/ /home/jdoe [jdoe@frazz jdoe]$ cd [jdoe@frazz jdoe]$ cd / [jdoe@frazz /]$ pwd ...

Get Unix Third Edition: Visual Quickstart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.