1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-21 21:42:08 +02:00
tldr/common/find.md
2014-02-10 13:18:10 -08:00

671 B

find

Find files under the given directory tree, recursively

  • find files by extension

find {{root_path}} -name {{'*.py'}}

  • run a command for each file
  • use {} within the command to access the filename

find {{root_path}} -name {{'*.py'}} -exec {{wc -l {} }}\; find {{root_path}} -name {{'*.py'}} -exec {{rm {} }}\;

  • find files modified since a certain time

find {{root_path}} -name {{'*.py'}} -mtime {{-1d}}

  • find files using case insensitive name matching, of a certain size

find {{root_path}} -size +120k -iname {{'*.dOC'}} find {{root_path}} -size -100M -iname {{'*.moV'}} find {{root_path}} -size -1.2T -size +800G -iname {{'*.TaR.gZ'}}