递归查找可执行文件

Mak*_*iev 4 find executable recursive command

我有调用的目录Test和其中的几个目录。两者Test和其中的目录都有可执行文件。我想用ls. 我会使用这个命令。

ls -l `find Test/ -perm /u=x,g=x,o=x -type f`
Run Code Online (Sandbox Code Playgroud)

这是一个好的/正确的/快速的命令吗?

我的解决办法是:

find Test/ -executable -type f -exec ls -l {} \;
Run Code Online (Sandbox Code Playgroud)

并得到了与warl0ckpradeepchhetri提供的相同的结果。

dai*_*isy 8

不是真的,您可以将 ls 命令与 find 集成,

find Test/ -type f -perm /u=x,g=x,o=x -exec ls -l {} \;

更新

实际上-executable并不等同于-perm /u=x,g=x,o=x. 您可能有只能由组或其他人执行的文件,这些文件不会显示。

因此,取决于您的目的,如果您希望文件只能由您执行,则可以使用-executable.