Linux find command - two filename patterns Here's an example of how to search in the current directory and all subdirectories for files ending with the the extensions .class and .sh using the find command: find . -type f \( -name "*.class" -o -name "*.sh" \) That shou...
find / -name foo.txt # don't have to specify "type==file" find . -name foo.txt # search under the current dir find . -name "foo.*" # wildcard find . -name "*.txt" # wildcard find /users/al -name Cookbook -type d # search '/users/al' search multiple dirs --- find /o...
find ./ -size 0 -exec rm {} \; 删除文件大小为零的文件 (还可以以这样做:rm -i `find ./ -size 0` 或 find ./ -size 0 | xargs rm -f &) 为了用ls -l命令列出所匹配到的文件,可以把ls -l命令放在find命令的-exec选项中:find . -type f -exec ls -l { } \; 在/logs目录中查找更...
find -type f \( -name "*.txt" -o -name "*.msi" \)Search for multiple files and multiple patterns In a similar approach, you can extend the above command for more files by using extra -o options. Excluding Certain Files from the Search Results The find command can also exclude certai...
17. Find and Remove Single File To find a single file calledtecmint.txtand remove it. # find . -type f -name "tecmint.txt" -exec rm -f {} \; 18. Find and remove Multiple File To find and remove multiple files such as.mp3or.txt, then use. ...
+. Ends the-execcommand and indicatesfindshould pass multiple filenames togrepat once, rather than invokinggrepseparately for each file. This is more efficient than runninggrepfor each file individually. Find by Size Use thefindcommand to search for files based on their size. The-sizeoption allo...
Usage: grep [OPTION]... PATTERNS [FILE]... Search for PATTERNS in each FILE. Example: grep -i 'hello world' menu.h main.c PATTERNS can contain multiple patterns separated by newlines. Pattern selection and interpretation: -E, --extended-regexp PATTERNS are extended regular expressions ...
find . -type f \( -name "*cache" -o -name "*xml" -o -name "*html" \) # three patterns find files that don't match a pattern (-not) --- find . -type f -not -name "*.html" # find all files not ending in ".html" find files by text in the file (find + grep) -...
find . -name "*.XC" -mount –print 从当前目录开始查找位于本文件系统中文件名以XC结尾的文件(不进入其他文件系统) -follow:如果find命令遇到符号链接文件,就跟踪至链接所指向的文件。 1.3、find与xargs 在使用find命令的-exec选项处理匹配到的文件时, find命令将所有匹配到的文件一起传递给exec执行。但有些系...
腾讯云开发者社区是腾讯云官方开发者社区,致力于打造开发者的技术分享型社区。提供专栏,问答,沙龙等产品和服务,汇聚海量精品云计算使用和开发经验,致力于帮助开发者快速成长与发展,营造开放的云计算技术生态圈。