find
学这三个命令之前,还是要先来个开胃菜,学一下find
命令:
find /etc/ -name *.txt # 查找etc下面所有的txt文件
find /etc/ -name feed -type f # 查找feed文件,-type 后面跟d ,查找feed目录
find tests/ -name uu -exec cp {} tests/gg \; # -exec效果更强大,直接找到uu,并且复制到后面的路径为gg,后面可以加各种操作,这里只是示范cp
grep
grep -v "#" /etc/xx.conf | grep -v "^$" # -v过滤掉 以“#”开头的行 -v "^$" 过滤掉空行