A sed command to display non-visible characters in a text file

I just ran into a need to see what non-printable (non-visible?) characters were embedded in a text file in a Unix system, when I remembered this old sed command:

sed -n 'l' myfile.txt

Note that the character in that sed command is a lower-case letter "L", and not the number one ("1").

This command shows the contents of your file, and displays some of the nonprintable characters with the octal values. On some systems tab characters may also be shown as ">" characters.

Similar to vi binary mode

This is similar to using the cat command, except for the handling of the non-printing characters. I think you can also see something similar with the vi "binary mode" argument, like this:

vi -b myfile.txt