Monday, January 08, 2007

View a Directory Structure Recursively

Oftentimes you will want to view the contents (subdirectories) of a directory but may not want to change directories. Why? Traversing deep directories takes valuable time.

Here's what you can do with the ls (list) command coupled with few options and then pipe the output to the more command.

#cd /home/esofthub
#ls -ltrR | more
This command syntax will allow you to view the contents in a long list format (l), in time order (t), reverse time sort order (r) and recursively (R). The more command will control the flow of the output.

Here's an example of what you will see.
#ls -ltrR | more
dir1
contents

dir2
contents

dir3
contents

dir4
contents

and soforth

No comments: