一、作用

  1. linux的一个文本输出命令,通常用于查看文件内容

二、选项

```
[root@mysql opt]# cat -E /etc/yum.repos.d/CentOS-Base.repo 
# CentOS-Base.repo$
#$
# The mirror system uses the connecting IP address of the client and the$
# update status of each mirror to pick mirrors that are updated to and$
# geographically close to the client.  You should use this for CentOS updates$
# unless you are manually picking other mirrors.$
#$
# If the mirrorlist= does not work for you, as a fall back you can try the $
# remarked out baseurl= line instead.$
[root@localhost network-scripts]# cat 1.txt 
1  this is line 1
     2  this is line 2
     3  log2 this is line 1
     4  log2 this is line 2
     5  log2 this is line 3
//更多请阅读:https://www.yiibai.com/linux/cat.html


[root@localhost network-scripts]# cat 2.txt 
1232312
[root@localhost network-scripts]# cat -n 1.txt 2.txt 
     1    1  this is line 1
     2         2  this is line 2
     3         3  log2 this is line 1
     4         4  log2 this is line 2
     5         5  log2 this is line 3
     6    //更多请阅读:https://www.yiibai.com/linux/cat.html
     7    
     8    
     9    1232312
[root@localhost network-scripts]# cat -b 1.txt 2.txt >log.log 
[root@localhost network-scripts]# cat log.log 
     1    1  this is line 1
     2         2  this is line 2
     3         3  log2 this is line 1
     4         4  log2 this is line 2
     5         5  log2 this is line 3
     6    //更多请阅读:https://www.yiibai.com/linux/cat.html


     7    1232312
[root@localhost network-scripts]# cat  1.txt 2.txt >log.log 
[root@localhost network-scripts]# cat log.log 
1  this is line 1
     2  this is line 2
     3  log2 this is line 1
     4  log2 this is line 2
     5  log2 this is line 3
//更多请阅读:https://www.yiibai.com/linux/cat.html


1232312
[root@localhost network-scripts]# cat >log.txt <<EOF
> jasaid
> lkk
> EOF
[root@localhost network-scripts]# cat log.txt 
jasaid
lkk