显示文件内容
[root@linuxcool ~]# cat anaconda-ks.cfg
#version=RHEL8
ignoredisk --only-use=sda
autopart --type=lvm
# Partition clearing information
………………省略部分输出信息………………
]# cat /etc/redhat-release #显示系统版本
[root@linuxcool ~]# cat -n anaconda-ks.cfg
1 #version=RHEL8
2 ignoredisk --only-use=sda
3 autopart --type=lvm
4 # Partition clearing information
5 clearpart --none --initlabel
6 # Use graphical install
………………省略部分输出信息………………
]# cat -n /etc/shells #查看文件时,显示每行的行号
]# cat -n /etc/fstab
[root@linuxcool ~]# cat /dev/null > file.txt #清空文件内容(/dev/null是linux系统的黑洞文件)
[root@linuxcool ~]# > /etc/file.txt #直接清空文件,留下了一个空行
[root@linuxcool ~]# echo > file.txt #直接清空文件内容,不留空行
[root@linuxcool ~]# cat > anaconda-ks.cfg << EOF
> Hello,World
> Linux!~
> EOF
[root@linuxcool ~]# cat anaconda-ks.cfg
Hello,World
Linux!~
[root@linuxcool ~]# cat /dev/cdrom > rhel.iso
[root@linuxcool ~]# ls rhel.iso -lh
-rw-r--r--. 1 root root 6.7G May 2 00:43 rhel.iso
[root@linuxcool ~]# file rhel.iso
rhel.iso: DOS/MBR boot sector; partition 2 : ID=0xef, start-CHS (0x3ff,254,63), end-CHS (0x3ff,254,63), startsector 23128, 19888 sectors