How to recursively search for files by file name and extension with the 'find' command in Linux?

Published on Aug. 22, 2023, 12:17 p.m.

To recursively search for files by file name and extension with the ‘find’ command in Linux, you can use the following command:

find /path/to/directory -type f -name "*.extension"

This will find all files with the specified extension in the specified directory and its subdirectories. You can replace /path/to/directory with the path to the directory you want to search, and replace extension with the file extension you want to search for.

For example, to search for all files with the extension .txt in the directory /home/user/files, you can use the following command:

find /home/user/files -type f -name "*.txt"

I hope this helps! Let me know if you have any other questions.

Tags: