Article Index

1. Find Files Using Name in Current Directory

 

Find all the files whose name is lost.txt in a current working directory.

 

# find . -name lost.txt

./lost.txt

 

2. Find Files Under Home Directory

 

Find all the files under /home directory with name lost.txt.

 

# find /home -name lost.txt

/home/lost.txt

 

3. Find Files Using Name and Ignoring Case

 

Find all the files whose name is lost.txt and contains both capital and small letters in /home directory.

 

# find /home -iname lost.txt

./lost.txt
./lost.txt

 

4. Find Directories Using Name

 

Find all directories whose name is lost in / directory.

 

# find / -type d -name lost

/lost

 

5. Find PHP Files Using Name

 

Find all php files whose name is lost.php in a current working directory.

 

# find . -type f -name lost.php

./lost.php

 

6. Find all PHP Files in Directory

 

Find all php files in a directory.

 

# find . -type f -name "*.php"

./lost.php
./login.php
./index.php