Linux – Replacing spaces in the file names December 23, 2022 by Tarik This should do it: for file in *; do mv "$file" `echo $file | tr ' ' '_'` ; done