Bash Show non printable characters


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.


$ 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