Recently shared snippets for language "Bash"

Created 7 months ago by anonymous
sudo find . -depth -name "*.$fileextension-old" -exec sh -c 'f="{}"; mv -- "$f" "${f%.$fileextension-old}.$fileextensionnew' \;

I want to rename all files ending with   tar.gz.ignored to tar.gz

sudo find . -depth -name "*.tar.gz.ignored" -exec sh -c 'f="{}"; mv -- "$f" "${f%.tar.gz.ignored}.tar.gz"' \;
Created 2 years ago by anonymous
grep -rnw '/path/to/somewhere/' -e 'pattern'
-r or -R is recursive,
-n is line number, and
-w stands for match the whole word.
-l (lower-case L) can be added to just give the file name of matching files.