find, locate, and whereis commands
One of the most common tasks in Linux system administration is finding files. In CentOS 8, there are several commands that you can use to find files based on different criteria. The most commonly used commands for finding files are find
, locate
, and whereis
. Each command has its own syntax and options, making them suitable for different use cases.
The find
command is used to search for files and directories based on various criteria such as name, size, type, and modification time. Here’s an example of how to use the find
command to search for all files with the .txt
extension in the current directory and its subdirectories:
Figure 2.29 – Finding files with the .txt extension
The first argument of the command is the starting directory for the search. In our example, the dot .
character means “current directory,” and -name
is used to specify the filename pattern to match. The *
character is...