Linux: How can I find a file on my system?

Originally published at: https://www.cyberciti.biz/faq/linux-how-can-i-find-a-file-on-my-system/

I have a remote server located in the data center. I login through SSH command line to manage my Linux server. How do I find a file called xyz on my Linux server system?

you can use the below command

find . -name filename

it will search the filename in the current directory

Thanks,
Sakthi

You can use locate command to find any file
Example: locate httpd

if you have come idea of where it may be you could run find

find /path/to/begin-search/from -type f -name xyz

You can do it from the root directory but it could take a while. You can also use the locate command. If the file has been there for less than 24 hours just be sure that you update the database that locate uses by running sudo updatedb. Then you can run the locate command.

locate xyz

or

locate --regex '.*/xyz$'

Just small note before running locate we have to run updatedb