What does the '-type' option do in the 'find' command?

The -type option in the find command is used to specify the type of files you want to search for. It allows you to filter the results based on the file type. Here are some common types you can specify:

  • f: Regular file
  • d: Directory
  • l: Symbolic link
  • c: Character device
  • b: Block device
  • s: Socket
  • p: Named pipe (FIFO)

Example Usage:

To find all directories in a specified path:

find /path/to/search -type d

To find all regular files:

find /path/to/search -type f

Using the -type option helps narrow down the search results to only the files that match the specified type, making it easier to locate what you're looking for.

0 Comments

no data
Be the first to share your comment!