Unix的发现:搜索可执行文件 [英] Unix find: search for executable files

查看:147
本文介绍了Unix的发现:搜索可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以与Unix的使用什么类型的参数/标志找到命令,使我搜索可执行文件?

What type of parameter/flag can I use with the Unix find command so that I search executables?

推荐答案

在发现你可以使用 -executable 的GNU版本:

On GNU versions of find you can use -executable:

find . -type f -executable -print

有关的BSD版本中找到,您可以使用 -perm + 和一个八进制面膜:

For BSD versions of find, you can use -perm with + and an octal mask:

find . -type f -perm +111 -print

在此背景下+表示这些位被置和111是执行位。

In this context "+" means "any of these bits are set" and 111 is the execute bits.

请注意,这不是等同于 -executable predicate在GNU找到。尤其是, -executable 该文件可以由当前用户执行测试,而 -perm +111 刚刚测试如果有执行权限设置。

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.

旧版本的GNU的发现也支持 -perm +111 语法,但作为的 4.5.12 此语法不再受支持。相反,你可以使用 -perm / 111 来获得这一行为。

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.

这篇关于Unix的发现:搜索可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆