printf
The printf command behaves similarly to the C printf() function and gives you more control over formatting
Print a sequence of numbers
printf '%s\n' {0..99}
Print alphabet in order
printf '%s\n' {a..z}
Retrieve all default binary paths
printf ${PATH//:/\\n}
Retrieve a List of All Default Executable Files in the $PATH Environment Variable
printf "%s\n" ${PATH//:/\/* }
for dir in ${PATH//:/ }; do
echo "$dir"/*;echo
done
Print a horizontal line
printf -v _hr "%*s" $(tput cols) && echo ${_hr// /${1--}}
Print date with colorized Date
printf "\033[33mDate:\033[37m %s\033[0m\n" "$(date)"
Print a random uuid
printf '%08x-%04x-%04x-%04x-%012x\n' $RANDOM$RANDOM $RANDOM $RANDOM $RANDOM $RANDOM$RANDOM$RANDOM
Repeat printing string 5 times
printf 'hello world\n%.0s' {1..5}