Finding files

Category:

List every files and directories (with relative paths) in the current directory and all its subdirectories.

find .

Or just

find

Same but just files.

find -type f

Just directiories.

find -type d


Search in the home directory (and all its subdirectories).

find ~

In the /mnt and /media directories.

find /mnt /media


Find something named “config”.

find -name "config"

Find all ruby files in the home directory.

find ~ -type f -name "*.rb"

Find all ruby files in the home directory, but not if they have letter “a” or “e” in their names.

find ~ -type f -name "*.rb" -not -name "*a*" -not -name "*e*"

Or

find ~ -type f -name "*.rb" ! -name "*a*" ! -name "*e*"