Category

Linux Command


Usage

find [-H] [-L] [-P] [-D debugopts] [-Olevel] [path...] [expression]


Manual

Required arguments

  • path string: The starting directory for the search.

Options

  • -name pattern: Search for files with the specified pattern in their name.
  • -type type: Search for files of the specified type. Valid types are:
    • d: Directory
    • f: Regular file
    • l: Symbolic link
    • b: Block special file
    • c: Character special file
    • p: FIFO (named pipe)
    • s: Socket
  • -size n[cwbkMG]: Search for files with a size of n blocks (default), bytes (c), 2-byte words (w), kilobytes (k), megabytes (M), or gigabytes (G).
  • -exec command {} ;: Execute the specified command on each matched file; {} represents the path of the file, and ; terminates the command.
  • -mtime n: Search for files modified n days ago. Use n for exact match, +n for more than n days ago, and -n for less than n days ago.
  • -mmin n: Search for files modified n minutes ago. Use n for exact match, +n for more than n minutes ago, and -n for less than n minutes ago.
  • -delete: Delete the matched files. Use with caution as this action is irreversible.


Share your experience or ask a question