1 of 14

There are a lot of ways to do this. The most portable two that I know of are sed and od - they're both POSIX.

printf '\n\r\b\t\033[01;31m' | sed -n l

It does like... read style escapes - C-style.



od is a little more configurable...

printf '\n\r\b\t\033[01;31m' |
od -v -w12 -t c -t a -A n

 \n  \r  \b  \t 033   [   0   1   ;   3   1   m
 nl  cr  bs  ht esc   [   0   1   ;   3   1   m

If you wanna know what all of those options do you can look in man od, but I specify I want two types of escapes - the -t c backslash escapes and the -t a named characters.