

How to find all files of a specific type recursively in Linux
source link: https://typeofnan.dev/how-to-find-all-files-of-a-specific-type-recursively-in-linux/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

TypeOfNaN
How to find all files of a specific type recursively in Linux
Nick Scialli • September 28, 2021 • 🚀 1 minute read
The find
command line utility is a powerful tool for searching your filesystem in Linux. A common use case is trying to find all files with a certain extension.
In the following example, we use the find
command to find all txt
files within the current directory, recursively.
find . -type f -name "*.txt"
Let’s break down how this works:
- The first argument we provide the
find
command is.
, which tellsfind
to start from the current directory. if we wanted to start in a subdirectory calledmy_directory
, our command would befind my_directory -type f -name "*.txt"
. - Next up, we have the
type
flag. As you might intuit, thef
is for files. You can also used
for directories. - Finally, we have the
name
flag. Since we’re looking for all.txt
files, we use a*
wildcard to indicate that we don’t really care what the file name is so long as it ends in.txt
.
Note that we don’t specify anything for searching recursively—this will be done automatically!
If you'd like to support this blog by buying me a coffee I'd really appreciate it!
Subscribe to my newsletter
If you are enjoying my blog, please sign up to get updates and code insights directly to your inbox.
- No spam
- Unsubscribe whenever
Powered by Buttondown

Nick Scialli is a software engineer at the U.S. Digital Service.
Recommend
-
60
README.md Decodify It can detect and decode encoded strings, recursively. Lets take this string : s0md3v and encode it in Base 64 czBtZDN2 Now...
-
43
Introduction How do you recursively get a list of all the files in a directory using Node.js ? Node.js has a built-in
-
16
List all files (recursively) in a directory yourbasic.org/golang Directory listing Use the ioutil.ReadDir function in package
-
9
Removing all .svn Folders Recursively with find Submitted by NanoDano on Tue, 04/23/2013...
-
12
Open only files containing a specific string, and then replace them on the Linux command line advertisements I have been using a simple find c...
-
10
TypeOfNaNHow to find all files of a specific type recursively in Unix-based operating systems (Linux and Mac)Nick Scialli • September 28, 2021 • 🚀...
-
5
[Bash] List All Files in Directory Recursively and Rename February 02, 2015
-
5
[Bash] Remove Execute Permission of Files in Directory Recursively ...
-
8
Find the number of contiguous subsequences which recursively add up to 9Skip to content
-
8
Re-encode FLAC files (recursively) for repairing encoding errors · GitHub Instantly share code, notes, and snippets. Re-en...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK