Linux Find Commands

Core Syntax

find [starting_path] [options] [expression]

The command searches recursively from the starting path, evaluating each file against your expressions.


Learning Workflow

Phase 1: Foundation — Master basic searches by name and type Phase 2: Filtering — Add time, size, and permission filters Phase 3: Actions — Execute commands on results Phase 4: Combining — Chain expressions with logical operators


Phase 1: Basic Searches

By Name

# Exact filename match
find /var/log -name "syslog"

# Case-insensitive match
find /home -iname "readme.txt"

# Wildcard patterns (quote to prevent shell expansion)
find /etc -name "*.conf"
find /opt -name "log*"

By Type

Flag
Type

-type f

Regular file

-type d

Directory

-type l

Symbolic link

-type s

Socket

-type p

Named pipe

Depth Control


Phase 2: Filtering

By Time

Three time types, each with three variants:

Base
Meaning

mtime

Modification time (content changed)

atime

Access time (last read)

ctime

Change time (metadata/inode changed)

Suffix
Unit

-mtime

Days

-mmin

Minutes

By Size

By Permissions

By Ownership


Phase 3: Actions

Display and Output

-printf Format Specifiers

Specifier
Meaning

%p

Full path

%f

Filename only

%s

Size in bytes

%u

Owner username

%g

Group name

%m

Permissions (octal)

%T+

Modification time

%A+

Access time

Execute Commands

Piping to Other Tools


Phase 4: Combining Expressions

Logical Operators

Practical Combinations


Troubleshooting Scenarios

Disk Space Investigation

Permission Issues

Recent Changes Investigation

Log File Management


DFIR-Relevant Searches


Performance Tips


Quick Reference Card

Task
Command

Find by name

find /path -name "pattern"

Find by type

find /path -type f/d/l

Modified < 24h

find /path -mtime -1

Larger than 100M

find /path -size +100M

Execute on results

find /path ... -exec cmd {} \;

Delete matches

find /path ... -delete

Combine OR

find /path -name "*.a" -o -name "*.b"

Exclude pattern

find /path ! -name "*.bak"

Suppress errors

find /path ... 2>/dev/null

Last updated