5. Advanced Options: The “find” command offers a wide range of advanced options to make the search more specific. These include options like “-iname” (case-insensitive search), “-not” (inverse search), “-
find /path/to/directory -maxdepth 1 -name "file.txt"组合多个条件:可以使用逻辑运算符来组合多个条件,例如,AND (-a) 和 OR (-o)。例如,搜索既满足文件名条件又满足文件类型条件的文件:find /path/to/directory -name "example.txt" -a -type f排除特定目录:如果你想要搜索一个目录但排除其中的特定...
The “find” command allows you to perform actions on the files that match the search criteria. Some commonly used options for this purpose are “-exec” and “-ok”. For example: “` find /path/to/search -name “*.txt” -exec ls -l {} \; # list the found files find /path/to...
#This is the default optimisation level and corresponds to the traditional behaviour. Expressions are reordered so that tests based only on the names of files (for example -name and -regex) are performed first. 2:Any -type or -xtype tests are performed after any tests based only on the na...
-exec Command {} \; example:find /tmp -atime +30 -exec mv {} {}.old \; 这里再引入一个命令: xargs - build and execute command lines from standard input 可以通过管道从标准输入建立和执行命令行 看了这么多,下面举几个例子吧: 1.查/tmp下属主属组不属于root,并且在5分钟之内改过的文件。
1[root@localhost ~]#find/var ! \( -user root -o -userlp-o -user gdm \)2/var/tmp/abrt3/var/lib/colord4/var/lib/colord/icc5/var/spool/postfix/defer6/var/spool/postfix/deferred...7/var/spool/postfix/public/flush8/var/spool/postfix/public/showq9/var/spool/postfix/saved10/var/spool...
find指令不仅可以搜索文件,还可以对搜索到的文件执行操作。例如,要删除当前目录下所有的.txt文件,可以使用以下命令: find . -type f -name "*.txt" -exec rm {} \; 这里的-exec rm {} \;表示对搜索到的每个文件执行rm命令。 总结 find指令是Linux中一个非常强大且常用的命令,它可以帮助用户根据不同的标...
If you are using find in an environment where security is important (for example if you are using it to search directories that are writable by other users), you should read the "Security Considerations" chapter of the findutils documentation, which is called Finding Files and comes with find...
更多的Linux find exec的例子 Linux上面find exec xargs 挂载一个文件系统 mount /dev/hda2 /mnt/hda2 挂载一个叫做hda2的盘 - 确定目录 '...rpm包 rpm -qa 显示系统中所有已经安装的rpm包 rpm -qa | grep httpd 显示所有名称中包含 "httpd" 字样的rpm包 rpm -qi package_name 获取一个已安装包的特殊...
delete find /var/log -name "vmware-*.*.log" -delete find /var/log -name "*.log" -exec truncate -s 0 {} \; find /var/log -name "system@*" -delete find /var/log -name "user-1000@*" -delete find /tmp/* -delete 至此CentOS7 安全加固脚本完毕。 原文地址: Linux与Windows服务...