Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the cat command to view invisible characters in Linux

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use the cat command to view invisible characters in Linux. It is very detailed and has a certain reference value. Friends who are interested must finish it!

From time to time, there is no syntax error in a program or software, and you do not find a problem when you check it. This is because there are many characters that are not displayed when you use normal text editor software to view them, but you can easily detect the presence of these characters by using the cat command on the terminal.

First, we create a simple text file that writes 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\ 012 > / tmp/testing.txt

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

$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 let's add some option parameters to cat so that we can display special characters.

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

Cat-T / tmp/testing.txt testing ^ I ^ testing more testing ^ I even more testing ^ I ^ I

Use the cat-E command to 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 ^ L ^ H $more testing$ ^ I ^ @ ^ K ^ @ even more testing$ ^ I ^ I $above is all the contents of the article "how to use the cat command to view invisible characters in Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report