실행 파일을 찾는 방법 검색하는 방법을 알고 싶습니다. 예를 들어

찾기 스위치가 있다는 것을 알고 있습니다. 하지만 특정 유형의 파일을 검색하는 방법을 알고 싶습니다. 예를 들어 실행 파일 만 검색하는 일종의 터미널 명령이 필요 합니다 .



답변

이것은 당신이 원하는 것을해야합니다 :

find . -perm -u+x -type f

실행 가능한 모든 것을 찾으려면 MIME 유형을 보거나 file 출력을 볼 수 있습니다. 모든 스크립트를 잡을 수는 없기 때문에 비생산적입니다.

참고 :
남자 페이지
유래


답변

이것은 또한 작동합니다.

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.