Find

Find

List all sub directory/file in the current directory

find .

List all files under the current directory

find . -type f

List all directories under the current directory

find . -type d

Edit all files under current directory (e.g. replace 'www' with 'ww')

find . -name '*.php' -exec sed -i 's/www/w/g' {} \;

# if there are no subdirectory
replace "www" "w" -- *
# a space before *

Find and output only filename (e.g. "mso")

Find large files in the system (e.g. >4G)

Find and delete file with size less than (e.g. 74 byte)

Find empty (0 byte) files

Recursively count all the files in a directory

Last updated

Was this helpful?