Here I am describing a simple command to locate files and folders from a Linux based server by using the file name. You can watch the video tutorial for this topic by clicking here.
Locate Command
This is the quickest way to find a file from a Linux server as the locate command is not searching through the file system for the name you are searching for. It is checking it in the 'mlocate.db' database file which contains all file paths in your system and which makes the check quicker.
We can simply install the locate command:
Centos Server:
# yum install mlocate
Ubuntu/Debian:
# sudo apt-get install mlocate
Before using the command, we need to update the DB using the following command:
# updatedb
Once it is done, you can simply use the command to find a file on the server by searching the file name:
eg: # locate my.cnf
The search is case sensitive. Please see the examples shown in the next image: