mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-23 21:20:42 +08:00
发布:Linux Terminal--Seeing the unseen characters with cat!
This commit is contained in:
parent
6ecc2be405
commit
0aacfa809d
@ -1,5 +1,6 @@
|
||||
Linux终端:用cat命令查看隐藏的字符
|
||||
================================================================================
|
||||
Linux终端:用cat命令查看不可见字符
|
||||
=============================
|
||||
|
||||
时常,某个程序或软件并没有语法错误,并且你检查它的相关内容也确实没有发现问题。这是因为你用普通文本编辑器软件来查看的时候,有许多字符没有显示出来,但在终端使用cat命令可以很容易地检测出是否存在这些字符。
|
||||
|
||||
首先,我们创建一个简单的文本文件,写入一些特殊字符。打开终端,运行命令:
|
||||
@ -26,7 +27,7 @@ Linux终端:用cat命令查看隐藏的字符
|
||||
|
||||
现在我们给cat加上一些选项参数,以便能显示出特殊字符来。
|
||||
|
||||
1) 用cat -T命令来显示TAB键的字符^I
|
||||
###用cat -T命令来显示TAB键的字符\^I
|
||||
|
||||
cat -T /tmp/testing.txt
|
||||
testing
|
||||
@ -37,7 +38,7 @@ Linux终端:用cat命令查看隐藏的字符
|
||||
even more testing
|
||||
^I^I^I
|
||||
|
||||
2) 用cat -E命令来显示行尾的结束字符$
|
||||
###用cat -E命令来显示行尾的结束字符$
|
||||
|
||||
$ cat -E /tmp/testing.txt
|
||||
testing$
|
||||
@ -48,7 +49,7 @@ Linux终端:用cat命令查看隐藏的字符
|
||||
even more testing$
|
||||
$
|
||||
|
||||
3) 用简单的cat -A命令就可以显示所有不可见的字符:
|
||||
###用简单的cat -A命令就可以显示所有不可见的字符:
|
||||
|
||||
$ cat -A /tmp/testing.txt
|
||||
testing$
|
||||
@ -57,7 +58,7 @@ Linux终端:用cat命令查看隐藏的字符
|
||||
^I^@^K^@even more testing$
|
||||
^I^I^I$
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
---
|
||||
|
||||
via: http://linuxaria.com/pills/linux-terminal-seeing-the-unseen-characters-with-cat?lang=en#more-7645
|
||||
|
||||
@ -65,13 +66,4 @@ via: http://linuxaria.com/pills/linux-terminal-seeing-the-unseen-characters-with
|
||||
|
||||
译者:[runningwater](https://github.com/runningwater) 校对:[Caroline](https://github.com/carolinewuyan)
|
||||
|
||||
[1]:
|
||||
[2]:
|
||||
[3]:
|
||||
[4]:
|
||||
[5]:
|
||||
[6]:
|
||||
[7]:
|
||||
[8]:
|
||||
[9]:
|
||||
[10]:
|
||||
|
Loading…
Reference in New Issue
Block a user