• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 20. Using Basic Unix Commands > Listing Directory Contents

Listing Directory Contents

Working in UNIX requires information on the current working directory and it's contents. Both of these commands are simple to execute within the Terminal window. If you want to know where you are, just type pwd (print working directory), and then press Return. UNIX does not print anything; instead it displays the path and name of the current working directory, such as Users/andyanderson. To list the contents of that directory type the ls (list) command, and then press Return. The terminal window displays the contents of the working directory, i.e. Users/andyanderson. But it doesn't stop here, to list the contents of a specific directory, type ls and the directory path—for example, ls Users/andyanderson/ Documents. In addition, UNIX allows for paths to specific files, and the use of flags, which instruct the Terminal window what to display.

List Directory Contents

Open the Applications folder, double-click the Utilities folder, and then double-click the Terminal icon.

Type pwd, and then press Return to display the current user.

Type ls, and then press Return to display the contents of the working directory.

Click the Close button.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint