Unix Power ToolsUnix Power ToolsSearch this book

8.4. List All Subdirectories with ls -R

By default, ls lists just one directory. If you name one or more directories on the command line, ls will list each one. The -R (uppercase R) option lists all subdirectories, recursively. That shows you the whole directory tree starting at the current directory (or the directories you name on the command line).

This list can get pretty long; you might want to pipe the output to a pager program such as less (Section 12.3). The ls -C option is a good idea, too, to list the output in columns. (When the ls output goes to a pipe, many versions of ls won't make output in columns automatically.)

-- JP



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.