25.7 Show Non-Printing Characters with cat -v or od -c Especially if you use an ASCII-based terminal, files can have characters that your terminal can't display. Some characters will lock up your communications software or hardware, make your screen look strange, or cause other weird problems. There are a lot of characters that usually are not printed if you use a normal text editor, but you can easily check if they are present with your terminal and the command cat.
As first thing let's create a simple text file with these special characters, open a terminal and run the command. 5 cat has a -v option which converts non-printing characters to their caret notation (which is useful if we don't want the terminal to interpret the control characters literally in cat output). But as I understand, the caret notation only applies to non.
I want to make a file including non-printable characters to just only include printable characters. I think this problem is related to ACSCII control action, but I could not find a solution to do t. Below, find a list of all non printable characters, along with their binary, decimal and hexadecimal codes.
You can also find their escape sequence (used in many programming languages), and caret notation (used with cat -v). For the list of non printable characters with full names, please see the original article here. Learn Bash - Show non printable charactersThis 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.
Seeing Non-Printable Characters If you want to inspect a file to see if there are any non-printable characters present, you can use cat -A (which shows all characters). View non-printable unicode characters Online tool to display non-printable characters that may be hidden in copy&pasted strings. Those lines contain tabs as well as some non-printable characters.
So, when the same command was run with the -A command line option, tabs got replaced by ^I, and non. In this blog post you will see Table of non.