Get a recursive directory listing in Unix

If you want a recursive directory listing in Unix, one of the following may be useful:

ls -R Not all versions of ls have -R
find . -print Should work everywhere
du -a .
Shows you both the name and size

If you're looking for a wildcard pattern that will match all .c files in and below a certain directory, you won't find one, but you can use:

  some-command `find . -name '*.c' -print`

Replace some-command with the command you want to run.

This information comes from the Unix FAQ, which is posted regularly to the Usenet newsgroups comp.unix.questions and You can get it by FTP from in the /pub/usenet directory, and on the web at Unix FAQ/faq Index.

This is document abef in the Knowledge Base.
Last modified on 2019-02-04 10:29:18.

Contact us

For help or to comment, email the UITS Support Center.