Results 1 to 5 of 5

Thread: How to Count executable (x) files in Linux / UNIX?

  1. #1
    Senior Member eawedat's Avatar
    Join Date
    May 2008
    Location
    Palestine
    Posts
    320
    Thanks
    4
    Thanked 3 Times in 3 Posts
    Rep Power
    7

    Smile How to Count executable (x) files in Linux / UNIX?

    hey all,,
    I need a script or line of command that counts files that have "x" perrmission.

    thanks.

  2. The Following User Says Thank You to eawedat For This Useful Post:

    jaysunn (4th June 2009)

  3. #2
    Contributors jaysunn's Avatar
    Join Date
    Apr 2009
    Location
    NYC - USA
    Posts
    1,023
    Thanks
    164
    Thanked 153 Times in 132 Posts
    Rep Power
    24

    Default

    You can give this a try. Change to the directory that you are planning to perform the executable count. And execute the following:

    Code:
    find . -type f -perm -o+rx | wc -l

    Hope this helps.

    Jaysunn

  4. #3
    Never say die nixcraft's Avatar
    Join Date
    Jan 2005
    Location
    BIOS
    Posts
    4,512
    Thanks
    17
    Thanked 799 Times in 511 Posts
    Rep Power
    10

    Default

    GNU/find has the -executable option:
    Code:
    find /usr/sbin -executable | wc -l
    All [Solved] threads are closed by mods / admin to avoid spam issues. See Howto mark a thread as [Solved]


  5. The Following User Says Thank You to nixcraft For This Useful Post:

    jaysunn (4th June 2009)

  6. #4
    Senior Member eawedat's Avatar
    Join Date
    May 2008
    Location
    Palestine
    Posts
    320
    Thanks
    4
    Thanked 3 Times in 3 Posts
    Rep Power
    7

    Default

    thanks jaysunn & nixcraft

    nixcraft i think ur command seeks also in subdirectories ,,
    when using urs i got the number 318 (wide number)

    when using jaysnn's i get the number "4"

    10x..

  7. The Following User Says Thank You to eawedat For This Useful Post:

    jaysunn (4th June 2009)

  8. #5
    Never say die nixcraft's Avatar
    Join Date
    Jan 2005
    Location
    BIOS
    Posts
    4,512
    Thanks
    17
    Thanked 799 Times in 511 Posts
    Rep Power
    10

    Default

    Quote Originally Posted by eawedat View Post
    nixcraft i think ur command seeks also in subdirectories ,,
    when using urs i got the number 318 (wide number)
    Try
    Code:
     find /usr/sbin -executable -type f | wc -l
    335
    Code:
    find /usr/sbin/ -type f -perm -o+rx | wc -l
    334

    Almost a close match!
    All [Solved] threads are closed by mods / admin to avoid spam issues. See Howto mark a thread as [Solved]


  9. The Following User Says Thank You to nixcraft For This Useful Post:

    jaysunn (5th June 2009)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Linux / UNUX directory hard link count
    By vaibhav.kanchan in forum Linux software
    Replies: 4
    Last Post: 13th December 2008, 02:10 AM
  2. Rename multiple files in UNIX
    By sweta in forum Getting started tutorials
    Replies: 1
    Last Post: 26th October 2008, 10:44 AM
  3. Linux / UNIX Remove All Files in Folder Ending With ~ Symbol
    By demuytree in forum Shell scripting
    Replies: 4
    Last Post: 17th August 2008, 07:25 AM
  4. UNIX ls only directories (display only dirs and no files)
    By chiku in forum Solaris/OpenSolaris
    Replies: 1
    Last Post: 21st October 2006, 12:27 AM
  5. Script to remove executable files
    By sweta in forum Shell scripting
    Replies: 4
    Last Post: 12th March 2005, 01:21 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •