Complete guide to using the find command in Linux

Introduction to the find command

The find command is one of the most powerful and versatile tools in the Linux environment for locating files and directories based on multiple criteria. Its ability to combine tests, actions, and operators makes it an indispensable ally for administrators, developers, and advanced users.

Basic syntax

The simplest form is find [path] [expression]. If the path is omitted, find starts from the current directory. For example, find /home/user -name '*.txt' lists all files with the .txt extension under the specified directory.

Search by name

The -name predicate accepts shell-style patterns. To ignore case, use -iname. Example: find /var/log -iname '*error*' returns any file whose name contains the word error, regardless of case.

Filter by file type

With -type you specify the type: f for regular file,

This post is also available in ESPAÑOL.

Esta obra está bajo una Licencia Creative Commons Atribución 4.0 Internacional para Francesc Roig francesc@vivaldi.net .