ripgrep
searches significantly faster in comparison to grep
.
$ rg 'test' -g '*.py'
ripgrep
supports formats zip, gzip, bzip2, xz, lzma, zstd, etc.. To search inside gzipped file:
$ rg -z --text 'test' file.gz
rga
can search in pdf and docx/odt files.
$ rga test *
Find "update" in all files recursively and show line number using grep
:
$ grep -r --color -n "update" *
Find "Debian" in html and md files:
$ grep -r --color -n --include="*.{html,md}" --exclude-dir=.git "Debian" *
Find "Google" excluding files "*hosts.txt" and directory "img":
$ grep -r --color -n --exclude-dir="img" --exclude="*hosts.txt" "Google" *
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