Fastest way to rename filenames with space to dash in linux

I want to mass rename hundred of filenames like
filename 001.jpg to filename-001.jpg



filename 099.jpg to filename-099.jpg

I use this command to rename all in few seconds in my MacBook Pro.
I think it is fine to run in any linux.

for f in *\ *; do mv "$f" "${f// /-}"; done

Show Image Size in Terminal or Shell

The easiest way to show the file size in Terminal in Mac or Linux.

ustins-MacBook-Pro:jpg juzhax$ file 001.jpg
001.jpg: JPEG image data, EXIF standard
Justins-MacBook-Pro:jpg juzhax$ identify 001.jpg
001.jpg JPEG 720x468 720x468+0+0 8-bit sRGB 59.8KB 0.000u 0:00.009
Justins-MacBook-Pro:jpg juzhax$

command c expects followed by text error in Mac

You received error from the sed command in Mac, because the argument in mac is different.
If you type in Mac terminal, you may receive error like this

Justins-MacBook-Pro:2 juzhax$ sed -i 's/old_text/new_text/g' example.txt
sed: 1: "config.php": command c expects \ followed by text

The first argument should be the extension of the backup file. The correct way is

Justins-MacBook-Pro:2 juzhax$ sed -i '.bak' 's/old_text/new_text/g' example.txt

or

Justins-MacBook-Pro:2 juzhax$ sed -i '.original' 's/old_text/new_text/g' example.txt

If you don’t want any backup file, you can do like this.

Justins-MacBook-Pro:2 juzhax$ sed -i '' 's/old_text/new_text/g' example.txt