author

Command Cheat Sheet

Unix commands

Find a file by name

find . -iname <filename>

Examples:

Find all jpg files

find . -iname '*.jpg'

. = current directory

i = case insensitively

Rename multiple files

Renaming example-image_f08dycb.gif to example-image.gif

rename 's~_[a-z|0-9]+(?=\.gif$)~~' *.gif

Renaming all gif files in multiple folders

rename 's~_[a-z|0-9]+(?=\.gif$)~~' */*.gif

s = subtract

~ = delimiter; equivalent to / (slash) but if file name includes slashes you have to escape it \/

Note: For macOs, install rename first. Run brew install rename.

Reference: Bulk Rename Mp3 Files With Regular Expressions in Unix & Linux CLI