Skip to main content

find, grep

find

examples

find /path -name *.txt
find /path -type f -name test.txt
find /path -name failed*.* -type f
find /path -type f -not -name "*.html"
find / -name "file.txt" -size +4M
find /dev/ -type b -name "sda*"
find ./*file*

grep

grep [OPTION]... PATTERNS [FILE]...

  • options
    • -B <numb> - show numb lines before match
    • -A <numb> - show numb lines after match
    • -i - ignore case distinctions in patterns and data
    • -r, --recursive - like --directories=recurse
    • -v, --invert-match - To display only the lines that do not match a search pattern
    • --exclude-dir=<foldername> - exclude folder from search

examples

grep -ir --exclude-dir=vendor skeleton . - find all occurences of "skeleton" in the current working dir