深入解析Linux 常用命令--cat

深入解析Linux常用命令–cat

1.概述

cat常用于查看文件内容。

2.显示文件内容(显示字符)

cat -A 显示文件内容,包括结束符、TAB。其中结束符以$显示,TAB以^I显示,空格不显示。

[root@smart Desktop]# cat test.md
AUTHOR
       Written by Richard M. Stallman and David MacKenzie.
[root@smart Desktop]# cat -A test.md
AUTHOR$
^IWritten by Richard M. Stallman and David MacKenzie.$
$

3.显示行号

cat -b 显示非空行行号

cat -n 显示所有行行号

[root@smart Desktop]# cat -b test.md
     1  AUTHOR
     2         Written by Richard M. Stallman and David MacKenzie.

     3  REPORTING BUGS
     4         Report ls bugs to bug-coreutils@gnu.org
     5         GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
     6         General help using GNU software: <http://www.gnu.org/gethelp/>
     7         Report ls translation bugs to <http://translationproject.org/team/>
[root@smart Desktop]# cat -n test.md
     1  AUTHOR
     2         Written by Richard M. Stallman and David MacKenzie.
     3  
     4  REPORTING BUGS
     5         Report ls bugs to bug-coreutils@gnu.org
     6         GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
     7         General help using GNU software: <http://www.gnu.org/gethelp/>
     8         Report ls translation bugs to <http://translationproject.org/team/>

4.显示特殊字符

cat -E ,以$显示结束符,此时不会显示TAB字符。

cat -T,以^I显示TAB字符。

[root@smart Desktop]# cat -E test.md
AUTHOR$
    Written by Richard M. Stallman and David MacKenzie.$
[root@smart Desktop]# cat -T test.md
AUTHOR
^IWritten by Richard M. Stallman and David MacKenzie.   

Juyin@2017/12/22

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值