If you are looking for software to use, go to Huajun Software Park! software release

How to use cat command to display hidden characters in Linux

Author: Five Horses Acacia Date: 2017-05-17

Ubuntu For Linux
Ubuntu For Linux-14.10

operating system Storage: 1158720KB Time: 2014-04-22

Software Introduction: Ubuntu is a freely distributed and open source Linux-based operating system designed for humans, humans who have no previous experience with Linux...

Download now

In the Linux system, some characters are not displayed when viewed with an ordinary text editor. This requires the use of the cat command to view. The following is a tutorial on how to use the cat command to display hidden characters in Linux, which grasps the technical points. , it is much easier to learn. Hurry up and follow the Huajun editor to take a look! .

53-14120Q42Z5160.jpg

First, we create a simple text file and write some special characters. Open a terminal and run the command:

printf ‘testing 12 11 11testing 14 10 12more testing 12 11 00 13 00even more testing 12 11 11 11 12’ 》 /tmp/testing.txt

Now open it with different editor software, the displayed results will be different. Opening with a simple cat will show:

$ cat /tmp/testing.txt

testing

testing

more testing

even more testing

If you open it with nano or vim, you will see:

testing

testing^L^H

more testing

^@^K^@even more testing

Now we add some options 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 $ 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 the editor’s summary of how to use the cat command to display hidden characters in Linux. In addition to displaying invisible characters, the cat command has other functions. For details, please refer to System Home. How to use the cat command in Linux?

Related articles