首页 > 编程知识 正文

nosuchpartition命令解决办法,redis的incr命令解决并发

时间:2023-05-03 13:29:23 阅读:211025 作者:312

find搜索姿势

默认先处理文件夹,再处理文件夹
find [选项] [路径] [查找条件] [处理动作]

find后接命令

find命令强大之处在于

可以在查找到内容后,调用命令对查找到的内容进行进一步的处理 查看find帮助文件 [处理动作]相关内容 actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print -fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit -exec COMMAND ; -exec COMMAND {} + -ok COMMAND ; -execdir COMMAND ; -execdir COMMAND {} + -okdir COMMAND ; 按照帮助文件执行报错 [root@C6-56 ~]# find ./ -name 'Video*' -exec rm -rf {}find: missing argument to `-exec'[root@C6-56 ~]# find ./ -name 'Video*' -exec rm -rf {} ;find: missing argument to `-exec' 正确find加命令处理姿势 find -name "*.sh" -ok mv {} /opt ; 问一次移一次find -name "*.sh" -exec mv {} /opt ;不问直接移

{}花括号相当于find内置变量,代表前边find查找到的结果
一旦有-ok 或者有 -exec 后边就必须有 ;结束,这个是语法要求

实例1:查找当前目录下所有zip文件并删除

[root@C6-56 ~]# find ./ -name '*.zip'./Videos.tar.zip[root@C6-56 ~]# find ./ -name '*.zip' -exec rm {}find: missing argument to `-exec'[root@C6-56 ~]# find ./ -name '*.zip' -exec rm{}find: missing argument to `-exec'[root@C6-56 ~]# find ./ -name '*.zip' -exec rm {}find: missing argument to `-exec'[root@C6-56 ~]# find ./ -name '*.zip' -exec rm {} ;[root@C6-56 ~]# find ./ -name '*.zip'

实例2:查找当前目录下包含123的文件和文件夹并删除

[root@C6-56 ~]# ll 123*-rw-r--r--. 1 root root 81 Apr 8 13:03 123.txt-rw-r--r--. 1 root root 53 Apr 8 09:10 123.txt.bak123:total 8-rw-r--r--. 1 root root 7 Apr 8 07:09 123.txtdrwxr-xr-x. 3 root root 4096 Apr 8 07:09 321[root@C6-56 ~]# find ./ -name '123*'./123.txt.bak./123./123/123.txt./123/321/123./123/321/123/123.txt./123/321/123.txt./123.txt[root@C6-56 ~]# find ./ -name '123*' -exec rm -rf {}find: missing argument to `-exec'[root@C6-56 ~]# find ./ -name '123*'./123.txt.bak./123./123/123.txt./123/321/123./123/321/123/123.txt./123/321/123.txt./123.txt[root@C6-56 ~]# find ./ -name '123*' -exec rm -rf {} ;find: missing argument to `-exec'[root@C6-56 ~]# find ./ -name '123*'./123.txt.bak./123./123/123.txt./123/321/123./123/321/123/123.txt./123/321/123.txt./123.txt[root@C6-56 ~]# find ./ -name '123*' -exec rm -rf {} ;find: `./123': No such file or directory[root@C6-56 ~]# find ./ -name '123*'[root@C6-56 ~]#

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。