Unix File Listing

Up to now, all the commands you have learned have been important. Not one of them is uncommonly used or seen. This next command we discuss, however, will be a command that you use just about all the time as a typical Unix user, so we will spend some quality time reviewing its details as closely as possible. The command you do this with is the ls command, which lists files. Issued without any arguments (also known as switches), ls lists the files and subdirectories in the current directory. You can, of course, list files in a different directory by specifying that directory in the path statement or simply by changing into that directory and then issuing the ls command. An example of using pwd and ls is seen here:

> pwd /priv/home/rob/temp/newwebsite/ ...

Get SAMS Teach Yourself Unix in 10 Minutes 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.