1.cat 命令:将文件内容连接后传送到标准输出或重定向到文件。
1)命令语法格式:cat [OPTION] [FILE]...
2)命令选项参数说明如下所示。
-n(number):从第一行开始对文件输出的所有行继续编号;
-b:忽略对空白行的编号;
-s(--squeeze-blank):将连续的两个空白行合并为一行;
3)范例列举:
[root@rhl5 ~]# cat /etc/hosts # 显示文件的内容
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 rhl5.super.com rhl5 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
[root@rhl5 ~]# cat-n /etc/hosts > hosts # 对文件的行编号并重定向到hosts文件
[root@rhl5 ~]# cat hosts # 显示hosts文件的内容
1 # Do not remove the following line, or various programs
2 # that require network functionality will fail.
3 127.0.0.1 rhl5.super.com rhl5 localhost.localdomain localhost
4 ::1 localhost6.localdomain6 localhost6