Linux endpoints: view invisible characters with cat commands

Source: Internet
Author: User

Often, a program or software does not have a grammatical error, and you do not see the problem when you check its contents. This is because there are many characters that are not displayed when you use the normal text editor software, but it is easy to detect the presence of these characters in the terminal using the Cat command.

~ First, we create a simple text file that writes some special characters. Open terminal, Run 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 will be different. 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 some option parameters to cat so that special characters can be displayed.

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$

$


All invisible characters can be displayed 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$


Linux endpoints: view invisible characters with cat commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.