MYSYSAD.COM

Display Non-printable Characters in a Text File

· Shell & text · Files & disks

I received a message asking me how to see non-printable characters in a text file. Almost immediately, utilities such as vi, cat, and od come to mind. The od command clearly states which non-printable characters are present. Here are examples using a text file.

# vi filename.txt
^I^I^I^I$
$
$
$
this is a test$
^I^I^I^I$
~
: set list

# cat -vet filename.txt
^I^I^I^I$
$
$
$
this is a test$
^I^I^I^I$

# od -c filename.txt
0000000 \t \t \t \t \n \n \n \n t h i s i s
0000020 a t e s t \n \t \t \t \t \n
0000034

Related post

Using octal dump to find bad characters