Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I know there is a find switch. but I want to know how to search a specific type of file . For example I need kind of terminal command witch search for only executable files

share|improve this question
1  
Define executable? Almost every file in Linux can be executable. –  Mitch Mar 29 at 11:30
    
those files which in termial by type ./myfile they run –  lion Mar 29 at 11:32
    
I know there is -fstype but I do not know to how? –  lion Mar 29 at 11:32
    
File System type, fstype is used in Linux environment which states the file system type being used. –  Mitch Mar 29 at 11:35
    
@Mitch ok ok I think I can use that I saw that on man find. My qesestion is how to find thoses file which by chmod +x myfile we make them executable –  lion Mar 29 at 11:38
add comment

2 Answers 2

up vote 8 down vote accepted

This should do what you want:

find . -perm -u+x -type f  

If you want to find everything that could possibly be executable, you could look at mime-types or file output. That would be counter-productive though since you couldn't possibly catch every script.

References:
The man page
Stackoverflow

share|improve this answer
add comment

This also works,

find ~ -type f -executable

List all executable files inside your /home/$USER directory.

From 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.
share|improve this answer
    
@Raj thnka this one is working took –  lion Mar 29 at 12:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.