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 "^$" 過濾掉空行