Using the Unix find command

The Unix find command

The Unix find command

The find command is a convenient way to search for files on your machine through the command line.

The general form of the command is

find starting_directory match_criteria match_pattern output_action

 

 

Examples

Search through all directories on the machine

find / -name "pattern" -print

Breaking it down:

  • / : start the search at the top-most directory
  • -name : we are searching by filename
  • "pattern" : the filename pattern being searched for. This can be an exact name (e.g. nginx.conf) or a pattern (e.g. *.conf)
  • -print : display the full pathname of all matching files

 

More examples to come


 

Did you find this helpful and think it would be beneficial for someone else? Share now!

Leave a Reply

Your email address will not be published. Required fields are marked *