replace spaces in filenames with underscores – rename ‘y/ /_/’ * – This command will replace all the spaces in all the filenames of the current directory with underscores. There are other commands that do this here, but this one is the easiest and shortest.
Source: replace spaces in filenames with underscores | commandlinefu.com