Find all files matching pattern recursively linux (Debian/CentOS/Ubuntu)

I love grep and I love simple code.

1
find

find will show all files recursively from what directory you are currently in.

This will find all files, and then from that list it will show you files matching file.html

1
find | grep file.html

This will find all files again, and then grep files from that list matching file1.html OR file2.html

1
find | grep 'file1.html\|file2.html'

This will find all files again, and then grep files from that list matching file1.html OR file2.html and write the list to list.txt

1
find | grep 'file1.html\|file2.html' > list.txt

Leave a Reply

Your email address will not be published. Required fields are marked *