Just in case I need it again and don’t remember: for f in <OLDPATTERN>; do mv “$f” “$(echo “$f” | sed ‘s/<OLDPATTERN>/<NEWPATTERN>/’)”; done And to batch-rename strings in all text-type files in a folder: for f in <FILEPATTERN>; do if [[ $(file “$f” | grep “text”) != “” ]]; then sed -i ‘s/<OLDPATTERN>/<NEWPATTERN>/g’ “$f”; fi;… Continue reading Linux batch rename one-liner
Tag: linux
Invalidate all nscd caches at once
If you ever need to invalidate all chached object of the nscd-daemon at once, you could try this one-liner: for f in /var/db/nscd/*; do nscd -i $(basename $f); done