The find command in Linux is a very versatile tool used to search for files and directories in the file system.
You can search for files based on different criteria such as name, type, size, modification date, among others. It is also possible to process the found files directly from the same command, without needing to use other tools or pass the results through tedious pipes or text files.
find
command:find [ruta] [opciones] [expresión]
find /ruta/donde/buscar -name "nombre_archivo"
This searches for a file named "filename" within the specified path.
find /ruta/donde/buscar -name "*.txt"
Searches for all files with the .txt extension in the specified path.
find /ruta/donde/buscar -size +50M
Finds files larger than 50 MB.
find /ruta/donde/buscar -type d
Finds all directories within the specified path.
Or, conversely:
find /ruta/donde/buscar -type f
Finds all files within the specified path.
find /ruta/donde/buscar -mtime -7
Finds files that were modified in the last 7 days.
find /ruta/donde/buscar -name "*.log" -exec rm {} \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\;
Finds all files with the .log extension and deletes them.
-name search by file name. -type search by type (f for file, d for directory). -size search by size. -mtime search by modification date. -exec to execute a command on the found files.
The flexibility of the find command allows for very specific searches.