Bash Using cat Show non printable characters

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

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`$


Got any Bash Question?