Master Linux ‘find’: Powerful File Search Techniques & Real‑World Examples
This guide explains how to use the Linux find command to locate files by name, size, time, permissions, owner or group, provides a full list of options, and includes practical examples demonstrating common search patterns and actions.
find: Search and locate files
Function description:
Using the find command you can list files that meet specified criteria such as name, type, time, size, permissions, etc. Only files that fully match are displayed.
Note: find's fuzzy search can be resource‑intensive; avoid running it during peak load.
Command syntax:
find [path] [options]Option meanings:
The options are described below: -name <filename>: search by name -iname <filename>: case‑insensitive name search -user <username>: search by file owner -group <groupname>: search by group -size n[ckMG]: search by size (c=bytes, k=KB, M=MB, G=GB) -type <filetype>: search by file type -nouser: files without an owner -nogroup: files without a group -atime n: accessed within the last n days -amin n: accessed within the last n minutes -ctime n: metadata changed within the last n days -cmin n: metadata changed within the last n minutes -mtime n: content modified within the last n days -mmin n: content modified within the last n minutes
Parameter examples:
Example 1 – Search by name
# find /test -name abc
/test/abc
# find /test -iname abc
/test/abc
/test/ABCExample 2 – Search by size
# find /date -size +10M
# find /date -size -1G
# find /date -size 98kExample 3 – Search by time
# find / -mtime -1 -type f
# find / -mtime +1 -type f
# find / -atime +1 -type f
# find / -atime -1 -type f
# find / -ctime -1 -type f
# find / -cmin +60 -type fExample 4 – Search by permissions
# find /test -perm 777Example 5 – Search by owner/group
# find / -user esight -type f
# find / -nouser -type f
# find / -group esight -type f
# find / -nogroup -type fExample 6 – Execute actions
# find /test -name "te.txt" -ok rm {} \;
# find /test -name "te.txt" -exec cp {} {}.bak \;Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
