cat、head、sed 三盟友

在linux 中我们必不可少的会使用到这三个命令
他们有什么作用呢?
就是查看文档了,但他的功能远不止于此

来我们学习一下吧
cat

cat、head、sed 三盟友

[root@ESProbe ~]# cat --help
Usage: cat [OPTION]... [FILE]...
Concatenate FILE(s), or standard input, to standard output.

-A, --show-all equivalent to -vET
-b, --number-nonblank number nonempty output lines, overrides -n
-e equivalent to -vE
-E, --show-ends display $ at end of each line
-n, --number number all output lines
-s, --squeeze-blank suppress repeated empty output lines
-t equivalent to -vT
-T, --show-tabs display TAB characters as ^I
-u (ignored)
-v, --show-nonprinting use ^ and M- notation, except for LFD and TAB
--help display this help and exit
--version output version information and exit

With no FILE, or when FILE is -, read standard input.

Examples:
cat f - g Output f's contents, then standard input, then g's contents.
cat Copy standard input to standard output.

GNU coreutils online help: http://www.gnu.org/software/coreutils/
For complete documentation, run: info coreutils 'cat invocation'

-b 显示行号

[root@ESProbe ~]# cat -b /etc/passwd
1 root❌0:0:root:/root:/bin/bash
2 bin❌1:1:bin:/bin:/sbin/nologin
3 daemon❌2:2:daemon:/sbin:/sbin/nologin
4 adm❌3:4:adm:/var/adm:/sbin/nologin
5 lp❌4:7:lp:/var/spool/lpd:/sbin/nologin
6 sync❌5:0:sync:/sbin:/bin/sync
7 shutdown❌6:0:shutdown:/sbin:/sbin/shutdown
8 halt❌7:0:halt:/sbin:/sbin/halt
9 mail❌8:12:mail:/var/spool/mail:/sbin/nologin
10 operator❌11:0:operator:/root:/sbin/nologin
11 games❌12

上一篇:Shell脚本三剑客——Grep(进阶版egrep)、Sed、Awk命令


下一篇:Linux三剑客--awk用法