find#

General Usage#

find <path> <expression>

Common Flags#

  • -name: Search by filename pattern (eg. -name '*.log'). Single quotes are recommended to prevent the shell from expanding wildcards prematurely.
  • -type: Filter by file type
    • f: file
    • d: directory
    • l: symbolic link
    • s: socket
    • p: named pipe (FIFO)
    • b: block device
    • c: character device
  • -print: Display results to standard output (default).
  • -print0: Separate results with a null character (\0). Useful for filenames with spaces.
  • -exec: Execute a command on the search results.
    • \; (Individual Execution): Runs the command once for each result. The semicolon must be escaped (\;) because it is a shell reserved character.
    • + (Batch Execution): Collects results and runs the command once with multiple arguments (similar to xargs). Better for performance.