grep

在grep搜索结果中包括或者排除指定文件:

# .表示当前目录。
#只在目录中所有的.php和.html文件中递归搜索字符"main()"
grep "main()" . -r --include *.{php,html}

#在搜索结果中排除所有README文件
grep "main()" . -r --exclude "README"

#在搜索结果中排除filelist文件列表里的文件
grep "main()" . -r --exclude-from filelist

当不存在sshd用户时,添加sshd用户信息到/etc/passwd

grep -q sshd /etc/passwd && echo "sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/bin/false" >> /etc/passwd

results matching ""

    No results matching ""