nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

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

This is a discussion on How to Count executable (x) files in Linux / UNIX? within the Shell scripting forums, part of the Development/Scripting category; hey all,, I need a script or line of command that counts files that have "x" perrmission. thanks....


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Linux answers from nixCraft.


Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-06-2009, 06:37 PM
eawedat's Avatar
Senior Member
User
 
Join Date: May 2008
Location: Palestine
OS: Kn0ck3D
Posts: 138
Thanks: 1
Thanked 2 Times in 2 Posts
Rep Power: 2
eawedat is on a distinguished road
Send a message via MSN to eawedat
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.
Reply With Quote
The Following User Says Thank You to eawedat For This Useful Post:
jaysunn (04-06-2009)
  #2 (permalink)  
Old 04-06-2009, 08:04 PM
jaysunn's Avatar
Powered By Linux
User
 
Join Date: Apr 2009
Location: 41.332032,-73.089775
OS: RHEL - OSX
Scripting language: BASH - Learning Ruby
Posts: 600
Thanks: 61
Thanked 78 Times in 70 Posts
Rep Power: 10
jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold
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
Reply With Quote
  #3 (permalink)  
Old 04-06-2009, 08:11 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 244 Times in 183 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

GNU/find has the -executable option:
Code:
find /usr/sbin -executable | wc -l
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
The Following User Says Thank You to nixcraft For This Useful Post:
jaysunn (04-06-2009)
  #4 (permalink)  
Old 04-06-2009, 08:22 PM
eawedat's Avatar
Senior Member
User
 
Join Date: May 2008
Location: Palestine
OS: Kn0ck3D
Posts: 138
Thanks: 1
Thanked 2 Times in 2 Posts
Rep Power: 2
eawedat is on a distinguished road
Send a message via MSN to eawedat
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..
Reply With Quote
The Following User Says Thank You to eawedat For This Useful Post:
jaysunn (04-06-2009)
  #5 (permalink)  
Old 05-06-2009, 03:53 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 244 Times in 183 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
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!
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
The Following User Says Thank You to nixcraft For This Useful Post:
jaysunn (05-06-2009)
Reply

Tags
bash , find , find -execcutable , gnu , linux , unix , wc command


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Linux / UNUX directory hard link count vaibhav.kanchan Linux software 4 13-12-2008 02:10 AM
Rename multiple files in UNIX sweta Getting started tutorials 1 26-10-2008 10:44 AM
Linux / UNIX Remove All Files in Folder Ending With ~ Symbol demuytree Shell scripting 4 17-08-2008 07:25 AM
UNIX ls only directories (display only dirs and no files) chiku Solaris/OpenSolaris 1 21-10-2006 12:27 AM
Script to remove executable files sweta Shell scripting 4 12-03-2005 01:21 PM


All times are GMT +5.5. The time now is 06:51 AM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38