Find

find(1) is a file finder.


Installation

find(1) will be pre-installed on any Linux or BSD operating system, as a POSIX utility.


Usage

find(1) identifies files and, by default, simply prints them.

find(1) can alternatively execute a command on the file name. Note that this occurs in a subshell, so functions and environment variables are not accessible to the command.

find . --exec mv ../backup/{} \;

File Name

To find all files with a name matching a pattern, try:

find . -name '*.pyc' -exec rm {} \;

File Ownership

To find all files owned by user foo, try:

find . --user foo -exec chown bar {} \;

To find all files in the group foo, try:

find . --group foo -exec chgrp bar {} \;


CategoryRicottone