Question about ls

Jim Cheetham jim at egressive.com
Thu Mar 3 08:00:15 UTC 2005


On Mar 3, 2005, at 8:43 PM, Bernhard wrote:
> ls -R /path/to/music > mymusic.txt
>
> lists recursively all the subdirectories in my music path as expected.
> What I want is, that only the existing subdirectories are listed, but
> not the actual content of the subdirectories.

ls is good at many things :-) and you could construct an interesting 
pipeline grepping for things that would be fun ...

ls -lR|grep ^d

but this doesn't list the full name of the directories, and without 
employing cut(1) leaves you with too much output.

Try the 'tree' program in universe, tree -d does a good portion of what 
you want, -df does more ...

-jim





More information about the ubuntu-users mailing list