generates random char number string in bash

Generate a random char

head /dev/urandom | tr -cd '[:alpha:]' | cut -c -1

Generate a random string with length 3

head /dev/urandom | tr -cd '[:alpha:]' | cut -c -3

Generate a random number with length 2

head /dev/urandom | tr -cd '[:digit:]' | cut -c -2

Generate a random alpha numeric string with length 5

head /dev/urandom | tr -cd '[:alnum:]' | cut -c -5

rename multiple files removing part of name

1 – Create 10 files with name “tmp file N”

touch tmp\ file\ {1..10}

2 – Rename all files replacing all spaces by underscores

rename 'y/ /\_/' tmp\ *

3 – Rename all files removing tmp_ from beginning

rename 's/tmp_//' tmp*

– Print names of files to be renamed, without renaming them

rename -n 's/tmp_//' tmp*

– Convert filenames to uppercase

rename 'y/a-z/A-Z/' tmp*