Linux terminal: Use the cat command to view invisible characters, linuxcat
Often, a program or software does not have syntax errors, and you check its related content and have not found any problems. This is because many characters are not displayed when you use the common text editor software, but the cat command on the terminal can easily detect whether these characters exist.
~ First, create a simple text file and write some special characters. Open the terminal and run the following command:
Printf 'testing \ 012 \ 011 \ 011testing \ 014 \ 010 \ 012 more testing \ 012 \ 011 \ 000 \ 013 \ 000 even more testing \ 012 \ 011 \ 011 \ 011 \ 011 \ 012 '>/tmp/testing.txt
Now open it with different editor software and 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 use nano or vim to open the file, you will see:
Testing
Testing ^ L ^ H
More testing
^ @ ^ K ^ @ even more testing
Now we add some option parameters to cat to display special characters.
Use the cat-T command to display the character ^ I of the TAB key
Cat-T/tmp/testing.txt
Testing
^ I ^ Itesting
More testing
^ I
Even more testing
^ 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 $
$
You can use the simple cat-A command to display all invisible characters:
$ Cat-A/tmp/testing.txt
Testing $
^ I ^ Itesting ^ L ^ H $
More testing $
^ I ^ @ ^ K ^ @ even more testing $
^ I $
Linux cat command
The main reason why cat cannot output Chinese characters is the terminal's own settings. If you look at the garbled characters, it indicates that the terminal uses the wrong character set to explain the characters, so garbled characters will appear. For example, if you use windows to provide the telnet login to Linux, it is certainly garbled, because Linux uses the character set is UTF-8.
Solution: If you log on to Linux using windows, such as the Development Board and PC, Putty is recommended. If you are Linux, set the character in the terminal menu.
How to check whether the linux file contains invisible characters
File. If it is in text format, invisible characters are always invisible... Invisible characters include \ n, \ t, and so on. For details, refer to zhidao.baidu.com/question/21146309.html
If you want to view all the files in the current directory (including hidden files), you can use ls-