码迷,mamicode.com
首页 > 其他好文 > 详细

Unix删除当前目录可执行文件

时间:2014-10-27 12:42:58      阅读:231      评论:0      收藏:0      [点我收藏+]

标签:io   ar   for   sp   strong   文件   on   art   bs   

On GNU versions of find you can use -executable:

find . -type f -executable -print
For BSD versions of find, you can use -perm with + and an octal mask:

find . -type f -perm +111 -print
In this context "+" means "any of these bits are set" and 111 is the execute bits.

Note that this is not identical to the -executable predicate in GNU find. In particular, -executable tests that the file can be executed by the current user, while -perm +111 just tests if any execute permissions are set.

Older versions of GNU find also support the -perm +111 syntax, but as of 4.5.12 this syntax is no longer supported. Instead, you can use -perm /111 to get this behavior.

--列出当前目录所有可执行文件
find . -type f -perm +111 -exec ls -l {} \;
--删除当前目录所有可执行文件
find . -type f -perm +111 -exec rm -f {} \;

 

Unix删除当前目录可执行文件

标签:io   ar   for   sp   strong   文件   on   art   bs   

原文地址:http://www.cnblogs.com/wucg/p/4053868.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!