TL;DW

# find with grep
# + concatinates results and runs the command once, faster
find . -name "*.txt" -exec grep -l "somename" '{}' '+'

# run a command for each result individually
find . -name "*.txt" -exec basename '{}' \';' |  column

# case insensitive
find -iname "SoMeNaMe.TxT

# file or dir
find -type f
find -type d

# define file owner
find -user Bob

# define file group
find -group wheel

# by permission
find -perm 777

# find by size
find -size +1G
  • vvv@programming.dev
    link
    fedilink
    arrow-up
    57
    ·
    7 months ago

    grep -r exists and is even more faster and doesn’t require passing around file names.

    grep -r --include='*.txt' 'somename' .
    
    • fmstrat@lemmy.nowsci.com
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      7 months ago

      Or use strings if you want clean binary results. (Grep can probably do this, too)

      Edit: Yes, with -b, also -R follows symlinks unlike -r