Bash Show non printable characters


Example

This is useful to see if there are any non-printable characters, or non-ASCII characters.

e.g. If you have copy-pasted the code from web, you may have quotes like instead of standard ".

$ cat -v file.txt
$ cat -vE file.txt # Useful in detecting trailing spaces.

e.g.

$ echo '”     ' | cat -vE # echo | will be replaced by actual file.
M-bM-^@M-^]     $

You may also want to use cat -A (A for All) that is equivalent to cat -vET. It will display TAB characters (displayed as ^I), non printable characters and end of each line:

$ echo '” `' | cat -A
M-bM-^@M-^]^I`$