1. 在当前目录及子目录中,查找大写字母开头的txt文件
指令: $ find . -name '[A-Z]*.txt' -print
2.在/etc及其子目录中,查找host开头的文件
指令: $ find /etc -name 'host*' -print
3.在$HOME目录及其子目录中,查找所有文件
指令: $ find ~ -name '*' -print
4. 在当前目录及子目录中,查找不是out开头的txt文件
指令: $ find . -name "out*" -prune -o -name "*.txt" -print
5.忽略文件名大小写查找a.txt
指令: find . /tmp -iname 'a.txt' -print
6.在当前目录除aa之外的子目录内搜索 txt文件
$ find . -path "./aa" -prune -o -name "*.txt" -print
7.在当前目录及子目录下,查找符号链接文件
指令: $ find . -type l -print
8.查找2天内被更改过的文件
指令: $ find . -mtime -2 -type f -print
9. 查找2天前被更改过的文件
$ find . -mtime +2 -type f -print
10. 查找超过1M的文件
指令: $ find / -size +1M -type f -print
11.查找文件中包含字符串的所有行,并存储
指令: grep re /usr/share/rhel/secrets/redhat.repo > /root/files
关于 有没有 -print 的区别
查找目录并列出目录下的文件(为找到的每一个目录单独执行ls命令,没有选项-print时文件列表前一行不会显示目录名称)