Description#

finds files or directories by name.

Usage#

# Search file in root directory with name test.txt
find / -name "test.txt"

# search all the files ending with txt extension and getting its long listing
find . -maxdepth 1 -name "*.txt" -exec ls -l {} \\;

# all files in home directory with size > 1MB
find ~ -type f -size +1M

Options#

OptionsDescription
-namename of the file or directory to search
-mindepthstart searching after certain depth
-maxdepthlimit search to certain depth
-execexecute a command for each file found
-permsearch for file with specific permission
-groupsearch files owned by specific group
-usersearch files owned by specific user
-typef for files, d for directories, l for symbolic links
-sizesize of the file or dir

Installation#

Distro/OS/Package ManagerInstall Instruction
Centos/fedora(dnf, microdnf, rpm, yum)yum install findutils
Debian/ubuntuapt install findutils
Arch (pacman)pacman -Sy findutils
Alpine (apk-docker)apk add findutils

References#