The Linux 'find' command is one of the most important and much used command in Linux sytems to search and locate list of files and directories based on conditions you specify for files that match the arguments. The following commands can be executed only if you have SSH access to server.
1. Find Files Using Name in Current Directory
Find all the files whose name is abc.txt in a current working directory.
# find . -name abc.txt
./abc.txt
2. Find Files Under Home Directory
Find all the files under /var directory with name abc.txt.
# find /var -name abc.txt
/var/abc.txt
3. Find Files Using Name and Ignoring Case
Find all the files whose name is abc.txt and contains both capital and small letters in /var directory.
# find /var -iname abc.txt
/var/abc.txt
/var/Abc.txt
4. Find Directories Using Name
Find all directories whose name is 'test' in / directory.
# find / -type d -name test
/test
5. Find PHP Files Using Name
Find all php files whose name is test.php in a current working directory.
# find . -type f -name test.php
./test.php
6. Find all PHP Files in Directory
# find . -type f -name "*.php"
./index.php
./test.php
7. Command to find all starting with 'test' in /var folder
# find . -type f -name "test*"
./test.php
./testing.php
8. Command to find a string inside the files
grep -irl ‘<text to search for>’ <directory to search>/*
# $ grep -irl 'welcome' /var/www/*
This command will recursively search for the string in all folders mentioned in the path.