List files in subdirectories recursively in Linux



The command used to list directory content in Linux is ls. With the -R option, ls will traverse the directory recursively, showing the content of the particular directory and all its subdirectories. Relative directory path is displayed before the directory content is actually listed.

The following is an example of the command in use;

$ ls -R testdir/
testdir/:
subdir1  subdir2

testdir/subdir1:
subsubdir1  subsubdir2

testdir/subdir1/subsubdir1:
file1

testdir/subdir1/subsubdir2:
file2

testdir/subdir2:
subsubdir1  subsubdir2

testdir/subdir2/subsubdir1:
file3

testdir/subdir2/subsubdir2:
file4

Posted on 17.12.2008 and categorized under linux

Comment Form


  • ayaz: Thanks for the tip.
  • TrueColorTech: Awesome Tip, I have been wanting that option for a while now!
  • iGadget: If this would work, it'd be really nice. However, when I use the command described in your post, I get the following error (twice): Could not conne
  • Alan: fedora 10 is so cool and i have fedora 10 too!
  • Kyle: Forgot to swing back by here after finding version 5.1.3 available, posted about it here: http://yokohead.com/2009/01/google-gears-in-firefox-x64-for

Categories