一、< 输入重定向
wc -l < filelist .txt 统计数据,从file这个文件拿结果。
二、tr 转换字符命令
$ tr `A-Z``a-z`<.bash_profile 将bash_profile文件中的大写字符全部转成小写字符
三、管道符(|)
comand1 | comand2 将command1的输出结果作为comand2的输入
ps axo %cpu,%mem,pid,comm --sort=-%mem |tee cpu11.txt |head -n 6 |tee cpu12.txt
tee是将每一次过程结果保存下来,并继续向后传递。如果使用重定向,该条命令则终止。
四、过滤(grep)
cat /etc/passwd | grep user1 匹配passwd文件中,user1的内容
五、输入追加<<
已EOF为起始符,EOF为结束符,将脚本内容直接追加并创建到镜像文件当中
#!/bin/bash
cat > /etc/yum.repos.d/dvd.repo << EOF
[Base0s]
name=Centos8
baseurl=file:///media/BaseOS
gpgcheck=0
EOF