Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the copy-the-code domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/pcx3.com/wp-includes/functions.php on line 6121

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pb-seo-friendly-images domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/pcx3.com/wp-includes/functions.php on line 6121

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the johannes domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/pcx3.com/wp-includes/functions.php on line 6121
How to find files in Linux using locate or find commands - PC✗3
How to find files in Linux using locate or find commands

How to find files in Linux using locate or find commands

In Linux, there are a variety of commands to locate files, each with its own set of advantages and disadvantages. Some are only available in certain distributions, and others are not installed by default.

Let’s start with the quickest approach to find files with locate, and then go on to find: a very powerful application that is available in virtually all Linux distributions to help users in finding files.


locate

Usagelocate <what you are looking for>
AdvantagesLooks through a database, therefore, is really fast
Disadvantagesthe database has to be updated in order to find new files

Install:

yum install mlocate

Then update the database with the command:

sudo updatedb && locate -e bench-repo

Otherwise you will get an error: locate: can not stat () `/var/lib/mlocate/mlocate.db’: No such file or directory

Example:

locate whois
image 114 - How to find files in Linux using locate or find commands

find

Usagefind <path> -name “<what you are looking for>”
AdvantagesNo database to use and has lots of advanced features
DisadvantagesCan be slow and requires more typing even for a simple search

Example:

Search for exact matches of “whois”

find / -name "whois"

Search for files that have “whois” in their name

find / -name "*whois*"
image 115 - How to find files in Linux using locate or find commands

Both of the above methods used for finding files in Linux can have many parameters. You can read the man page of locate or man page for find to read more ways to run the commands to find files.

whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.