Find Linux Command : Basic

In Unix-like and some other operating systems, find is a command-line utility that searches one or more directory trees of a file system, locates files based on some user-specified criteria and applies a user-specified action on each matched file.

  • Find is a command for recursively filtering objects in the file system based on a simple conditional mechanism.
  • Use find to search for a file or directory on your file system.
  • Using the -exec flag, files can be found and immediately processed within the same command.
  • Find command used to search and locate list of files and directories based on conditions you specify for files that match the arguments.

Lets’ have some Basic example to Understand and Usages of Find Command

Find Commands for Finding Files with Names

  • Find Files Using Name in Current Directory
# find . -name blog.eduguru.txt
  • Find Files Under Home Directory
# find /home -name blog.eduguru.txt
/home/blog.eduguru.txt

  • Find Files Using Name and Ignoring Case in /home directory
# find /home -iname blog.eduguru.txt
./blog.eduguru.txt
./blog.EDUGURU.txt

  • Find Directory Using Name in / directory
# find / -type d -name blog
/blog

  • Find all PHP Files in Directory
# find . -type f -name "*.php"
./test.php
./login.php
./index.php

One thought on “Find Linux Command : Basic

Leave a Reply