How to list all files recursively?

QuestionsQuestions8 SkillsProDec, 25 2025
0122

To list all files recursively (meaning you want to see the files in the current directory and all the files inside every sub-directory), you use the -R flag with the ls command.

1. Using ls -R

This is the most common way to do it:

ls -R

In your current environment, if you run this, you will see the contents of project/, and then it will automatically list what is inside testdir/ and new_testdir/.

2. Using find

If you want a simple, clean list of every file path, the find command is often better:

find .

The . tells it to start looking in the current directory. This will output a list of every file and directory starting from your current location.

3. Using tree (The most visual way)

If it's installed, tree provides a beautiful visual representation of your folder structure.

tree

Try it now:

Try running this in your terminal to see the difference:

ls -R

You'll see it prints the name of each directory followed by the files inside it. This is very helpful when you have moved files into folders (like you did in the previous steps) and want to verify where everything went!

0 Comments

no data
Be the first to share your comment!