SG Find Command Generator

SanchitGurukul Linux Utility

Find Command Generator

Build accurate, copy-ready find commands for locating files, auditing permissions, troubleshooting systems, and routine administration.

🔒Generated locallyNo command is executed or stored
Step 1

Define the search

Depth and traversal
Common tests
Advanced filters
Result action
Fast start

Predefined day-to-day commands

Daily use

Find a file by exact name

Search below the current directory for an exact filename.

find . -type f -name 'report.pdf'
Daily use

Find files ignoring case

Match README, readme, ReadMe, and other case variations.

find . -type f -iname 'readme*'
Logs

Find all log files

Locate files ending in .log below /var/log.

find /var/log -type f -name '*.log'
Troubleshooting

Files modified today

Find regular files changed within the last 24 hours.

find . -type f -mtime -1
Cleanup

Files older than 30 days

Review old files before archiving or deleting them.

find /path/to/data -type f -mtime +30 -print
Storage

Large files over 1 GB

Locate regular files larger than one gigabyte.

find / -xdev -type f -size +1G 2>/dev/null
Cleanup

Empty files

Find zero-byte regular files.

find . -type f -empty
Cleanup

Empty directories

Find directories that contain no entries.

find . -type d -empty
Navigation

Directories only

List every directory under the current path.

find . -type d
Permissions

Executable files

Find regular files executable by the current permission test.

find . -type f -executable
Security

World-writable files

Audit files writable by any user.

find /path/to/check -type f -perm -0002 -print
Administration

Owned by a user

Find files and directories owned by a specified account.

find /home -user username -print
Maintenance

Broken symbolic links

Locate symbolic links whose targets no longer exist.

find . -xtype l
Performance

Limit search depth

Search only the starting folder and one level below it.

find . -maxdepth 2 -type f
Media

Find multiple extensions

Match either JPG or PNG files, ignoring case.

find . -type f \( -iname '*.jpg' -o -iname '*.png' \)
Review

Show detailed results

Display find matches using an ls-style detailed format.

find . -type f -name '*.conf' -ls
Automation

Run a safe command per match

Display file information through stat without changing files.

find . -type f -name '*.txt' -exec stat -- '{}' \;
Danger

Delete old temporary files

Destructive example: preview first, then delete matching files.

find /tmp -type f -name '*.tmp' -mtime +7 -delete
Help guide

How to use Linux find safely

1

Choose a starting path

Use . for your current directory or a specific directory such as /var/log.

2

Add focused tests

Combine type, name, size, age, owner, permissions, and depth to reduce unwanted matches.

3

Preview the matches

Start with -print or -ls. Confirm every result before changing or deleting anything.

4

Copy and run

Paste the reviewed command into your Linux terminal. Permissions and supported options depend on the system.

Quick option reference

OptionPurposeExample
-type fRegular files onlyfind . -type f
-name / -inameMatch a filename, optionally ignoring case-iname '*.jpg'
-sizeMatch by rounded storage unit-size +100M
-mtimeMatch by modification age in 24-hour periods-mtime +30
-maxdepthLimit directory recursion-maxdepth 2
-permMatch permission bits-perm -0002
-execRun a command for every matching path-exec stat -- '{}' \;
-deletePermanently remove matchesPreview first
Performance tip

Use a specific starting path, -type, and -maxdepth. Searching from / can be slow and produce permission errors.

Important warning

Commands run with sudo, -delete, or a modifying -exec can affect critical system data. Review them carefully.

Your feedback matters

Was this post helpful?

0 reactions