Linux: End-Use cat commands view invisible characters

Source: Internet
Author: User

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

Related Article

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.