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
  • dohpaz42@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    7 months ago

    When using both {} and ;, it’s safer to use single quotes to escape the current argument and ending delimiter; eg ’{}’ and ’;’, respectively.

    • murtaza64
      link
      fedilink
      arrow-up
      3
      ·
      7 months ago

      Why? The quotes will be consumed by the shell when you execute the command, unless you do like "'{}'"