find 文件查找 命令格式: find dir -name filename command 例子: find . -name hello -print 寻找目前目录及所有的子目录内叫 hello的文档. find . -ctime +7 -print 找出七天内未被更动的文档 find . -size +2000m -print 找出大小超过2000 bytes的文档 find /tmp -user b1234567 -print 在/tmp下属於b1234567的文档 find . -name '*.c' -exec rm {} 删除所有的.c档 find . -name test\* -print 显示当前目录及其子目录...
:cry: 首先建立普通文件input.txt,内容为: There once was a man from NewYork. I learn linux first once in 2005. Who kept all of his cash first in a bucket,1999@. 在shell脚本中使用正则表达式,在inupt.txt文件中查找并输出包含”kept”的行,查找并输出包含”once”或者”first”而不包含数字的行。将以上输出保存在当前目录下的output.txt文件中。
如何用find 命令查找重复文件.有一个参考脚本: #/bin/sh # find the duplicate files in dir # by charry # find . -name "*" -exec md5sum {} ; | sort | uniq -d -w 33 但是在redhat as4 下执行出错: ./myfind.sh: line 7: syntax error near unexpected token `|' ./myfind.sh: line 7: `find . -name "*" -exec md5sum {} ; | sort | uniq -d -w 33' 谢谢.
查找/usr/local/apache/htdocs下所有虚拟主机包含index.html的文件。 如果用find /usr/local/apache/htdocs -name index.html,速度相当慢,如何可以优化一下?谢谢。 [ 本帖最后由 hiller1 于 2008-8-2 21:31 编辑 ]
比如在/home目录下,查找txt/doc/mp3/mp4结尾的文件。 我发现find可以支持 find /home -name "*[a-z]", 但是却不支持 find /home -name "*(txt|doc|mp3)", 请高手指点一下。