Search This Blog

Friday, June 18, 2010

How to list directories only.

To find directories only
(suppose a particular directory contains lot of files and directories and if we want to see only directories then use following command)

ls -l | grep ^d

find . -type d


Regular expression metacharacters
^ = Start of line
so "ls -l | grep ^d" will grep each line of output from ls for lines that begin with d and only d. (it will ignore d in any other position of the line).

Please find My post asking users to list directories only.

href="http://www.linuxquestions.org/questions/linux-newbie-8/how-to-list-directories-only-764450/

No comments:

Post a Comment