Find Files and Text

Find Files

Find png files recursively (current directory and sub-directories) and sort by path:

$ find . -name "*.png" | sort

Filter files having "deb" in file name ignoring text case and within current directory:

$ find . -maxdepth 1 -type f -iname "*deb*"

Count files with "AA" in name:

$ find . -maxdepth 1 -type f -name "*AA*" | wc -l

25 simple examples of Linux find command - BinaryTides

Find Text

Find "update" in all files recursively and show line number:

$ grep -r --color -n "update" *

Find "Debian" in txt-files only:

$ grep -r --color -n --include="*.txt" "Debian" *

zgrep can search in gz-files:

# zgrep -n "firefox" /var/log/apt/history.log*