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.

You can request just the directory name, or you can get fancy and request the directory's name and its contents, courtesy of ls.

To find out the name of the current directory:

  • pwd
    This command displays the path and name of the directory you are currently in. The path names each of the directories "above" the current directory, giving you the full picture of where you are in relationship to the system root.

To find out the name of the current directory and its contents: ...

Get Unix: 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.