Find files from the command line
One can very rapidly find files with arbitrary criteria on systems with GNU Findutils. This includes Linux, macOS and Windows Subsystem for Linux.
Install Findutuils
Linux normally comes with GNU Findutils already installed.
Windows users can do this via Windows Subsystem for Linux. macOS users can install GNU Findutils via Homebrew.
A wide range of criteria can be used to rapidly find files.
If working on a remote filesystem mounted over SSHFS we suggest SSHing into that system and running the find
command that–it will be orders of magnitude faster.
Most examples use home directory ~
as a starting point just for convenience.
Appending 2>/dev/null
to the end of a command removes nuisance messages about file permissions.
If piping the find
command, put 2>/dev/null
before the pipe.
Find files with “report” in the filename, case-insensitive:
find ~ -iname "*report*"
Suppose ~/data
is a symbolic link to another directory, either on your computer, a USB hard drive or a server.
By default, find will not search this resource unless you
“resolve” the symbolic link
to a directory by putting a final /
like ~/data/
:
find ~/data/ -iname "*report*"
See the
findutils manual on symbolic links
, in particular the -H
and -L
options.