Often, the program or software, and no syntax errors, you check its contents without finding related issues. This is the time, because you use ordinary text editing software to view, there are a lot of characters show not out, but in the end-use cat command can be very easy to detect the existence of these characters.
~ First. We create a simple text file. Write some special characters. Open terminal, execute command:
printf ' Testing\012\011\011testing\014\010\012more testing\012\011\000\013\000even more testing\012\011\011\ 011\012 '>/tmp/testing.txt
Now open with different editor software. The results are displayed differently. Open with a simple cat will display:
$ cat/tmp/testing.txt
Testing
Testing
More testing
Even more testing
If you open with nano or VIM, you will see:
Testing
Testing^l^h
More testing
^@^k^ @even More Testing
Now let's add a few options to cat so that we can display special characters.
Use the CAT-T command to display the TAB key character ^i
Cat-t/tmp/testing.txt
Testing
^i^itesting
More testing
^i
Even more testing
^i^i^i
Use the CAT-E command to display the ending character of the end of a line $
$ cat-e/tmp/testing.txt
testing$
Testing
$
More testing$
Even more testing$
$
You can display all the invisible characters with a simple cat-a command:
$ cat-a/tmp/testing.txt
testing$
^i^itesting^l^h$
More testing$
^i^@^k^ @even More testing$
^i^i^i$
Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.
Linux: End-Use cat commands view invisible characters