Linux uses the cat command to display hidden characters

  

Linux system, when using a normal text editor to view, some characters are not displayed, you need to use the cat command to view, the following small series for everyone Introduce Linux using the cat command to view hidden characters. Let's take a look at it.

First, we create a simple text file, write some special characters. Open the terminal and run the 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. Opening 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 arguments to cat so that we can display special characters.

Use the cat -T command to display the characters of the TAB key ^I

cat -T /tmp/testing.txt

testing

^I^ Itesting

more testing

^I

even more testing

^I^I^I

Using the cat -E command Display the end character at the end of the 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$

The above is how Linux uses the cat command to display hidden characters. The cat command can display invisible characters. In addition, there are other functions, specific reference to the system home Linux how to use the cat command?

Copyright © Windows knowledge All Rights Reserved