Как найти исполняемые файлы

Я знаю, что существует переключатель находки. но я хочу знать, как искать определенный тип файла. Например, мне нужен вид терминальной команды, которые ищут только исполняемые файлы.

8
задан 30 August 2018 в 13:04

2 ответа

Это должно сделать то, что Вы хотите:

find . -perm -u+x -type f  

, Если Вы хотите найти все, что могло бы возможно быть исполняемым файлом, Вы могли посмотреть на типы пантомимы или file вывод. Это было бы контрпродуктивно хотя, так как Вы не могли возможно поймать каждый сценарий.

Ссылки:
страница справочника
Stackoverflow

14
ответ дан 23 November 2019 в 05:23

Это также работает,

find ~ -type f -executable

Список все исполняемые файлы в Вашем /home/$USER каталог.

От man find

-executable
          Matches files which are executable  and  directories  which  are
          searchable  (in  a file name resolution sense).  This takes into
          account access control lists  and  other  permissions  artefacts
          which  the  -perm  test  ignores.   This  test  makes use of the
          access(2) system call, and so can be fooled by NFS servers which
          do UID mapping (or root-squashing), since many systems implement
          access(2) in the client's kernel and so cannot make use  of  the
          UID  mapping  information held on the server.  Because this test
          is based only on the result of the access(2) system call,  there
          is  no  guarantee  that  a file for which this test succeeds can
          actually be executed.
8
ответ дан 23 November 2019 в 05:23

Другие вопросы по тегам:

Похожие вопросы: