How to rename files by replacing text in Shell for i in $(ls); do mv -v "$i" "$(echo "$i" | sed 's/OldFilename/NewFilename/g')"; done