For all files in current directory

for i in *;do mv "$i" "${i// /_}";done