GARY IS COMING FOR YOU

You shouldn't have done that.

⚙ MALEVELON CREEK
CLICK TO SCAN
SPACE-BAR SERVICE DESK

Bartender

Here to help you explore

Questions and relevant page context are sent to TypeSafe. Questions Bartender cannot answer are saved to improve the site, without your account or IP. Other conversation stays in this tab.

find Tool Reference


find searches for files and directories in a directory hierarchy. Powerful tool for locating files by name, type, size, modification time, and more.


Basic Usage

  • find /path -name "pattern" - Find by name
  • find . -type f - Find files only
  • find . -type d - Find directories only
  • find . -name "*.txt" - Find by extension
  • find /path -exec command {} \; - Execute command

Search by Name

  • -name "pattern" - Exact name match
  • -iname "pattern" - Case-insensitive name
  • -path "pattern" - Match path
  • -regex pattern - Regular expression

Search by Type

  • -type f - Files
  • -type d - Directories
  • -type l - Symbolic links
  • -type b - Block devices
  • -type c - Character devices
  • -type p - Named pipes
  • -type s - Sockets

Search by Size

  • -size +100M - Larger than 100MB
  • -size -10k - Smaller than 10KB
  • -size 50c - Exactly 50 bytes
  • -empty - Empty files/directories

Search by Time

  • -mtime -7 - Modified in last 7 days
  • -mtime +30 - Modified more than 30 days ago
  • -atime -1 - Accessed in last 24 hours
  • -ctime -2 - Changed in last 2 days
  • -newer file - Newer than file
  • -amin -60 - Accessed in last 60 minutes
  • -mmin -30 - Modified in last 30 minutes

Search by Permissions

  • -perm 644 - Exact permissions
  • -perm -u+w - User has write
  • -perm /o+x - Others have execute
  • -user username - Owned by user
  • -group groupname - Owned by group

Actions

  • -print - Print results (default)
  • -ls - List like ls -dils
  • -delete - Delete found files
  • -exec command {} \; - Execute command
  • -exec command {} + - Execute with multiple files
  • -ok command {} \; - Interactive exec

Common Examples

Find by Name

find . -name "*.txt"

Find all .txt files.

Find Large Files

find / -size +100M

Find files larger than 100MB.

Find Recent Files

find . -mtime -7

Files modified in last week.

Find and Delete

find . -name "*.tmp" -delete

Delete all .tmp files.

Find and Execute

find . -name "*.sh" -exec chmod +x {} \;

Make scripts executable.

Find Empty Files

find . -type f -empty

Find empty files.

Find by User

find /home -user username

Find files owned by user.

Find Directories

find . -type d -name "config"

Find directories named config.


Tips

  • Use -name for simple patterns
  • Use -iname for case-insensitive
  • Use -type to filter file types
  • Use -size to find large/small files
  • Use -mtime for time-based searches
  • Be careful with -delete
  • Use -exec for batch operations
  • Essential for file system management