Linux - Replacing spaces in the file names
I prefer to use the command 'rename', which takes Perl-style regexes:
rename "s/ /_/g" *
You can do a dry run with the -n flag:
rename -n "s/ /_/g" *
This should do it:
for file in *; do mv "$file" `echo $file | tr ' ' '_'` ; done