- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Using the find command to find all executable file...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2001 08:17 PM
07-02-2001 08:17 PM
Your help will be appreciated.
Thanks,
Jo
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2001 08:46 PM
07-02-2001 08:46 PM
Re: Using the find command to find all executable files.
You can use the find command.
A simple command as below will find files
that all have permissions as 555
# find /opt -perm -555 | tee /tmp/file.out
Of course you can make them more complex if
you wish, but here is one to get you started.
Regards
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2001 08:55 PM
07-02-2001 08:55 PM
Re: Using the find command to find all executable files.
Hi
This script U can use for finding out the executables in ur server.
cd /
for i in `find .`
do
if test -x $i && test -f $i
then
ls >> /tmp/exelist
fi
done
I hope this will full fill ur requirement.
Shahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2001 08:58 PM
07-02-2001 08:58 PM
Re: Using the find command to find all executable files.
Hi
Now all executables will be listed in /tmp/exelist.
Shahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2001 11:19 PM
07-02-2001 11:19 PM
Re: Using the find command to find all executable files.
find / -type f -perm -555
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2001 11:28 PM
07-02-2001 11:28 PM
Re: Using the find command to find all executable files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2001 11:55 PM
07-02-2001 11:55 PM
Re: Using the find command to find all executable files.
The following script do what you need :
rm /tmp/executableFiles.log > /dev/null 2>&1
allFiles=`find / -name "*" -print`
for currentFile in $allFiles
do
isExecutable=`file $currentFile ? grep executable`
if [[ $isExecutable != "" ]]
then
echo $currentFile >> /tmp/executableFiles.log
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2001 01:07 AM
07-03-2001 01:07 AM
Re: Using the find command to find all executable files.
find . -type f -exec test -x {} \; -print
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2001 03:56 AM
07-03-2001 03:56 AM
SolutionIf you want to traverse all direcories on your server looking for executable permissions, regardless of other permission bits, do this:
# find / -xdev -type f \( -perm -u=x -o -perm -g=x -o -perm -o=x \)
This search returns only files (not directories, etc.) and will not cross mountpoints.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2001 11:23 AM
07-03-2001 11:23 AM
Re: Using the find command to find all executable files.
I like JRF's answer.
On the other hand, if you want a list of all executable files, regardless of their permissions, you can try something like:
find / -type f | while read -r file
do
file "$line"
done | grep -e exec -e commands
If you want to capture other types of files, you can
omit the grep part, save the output (it will contain a list
of all files on your system) to a file, then view the output and decide what types of files you would like to have extracted from this list (by using grep, etc).
My point is that there may be executables that have
no "execute" permission set. You may also have plain data files with 777 permission (so you won't be able to "run" them). Then, you can have scripts with read
only permission, but one can execute them via "sh", etc.
I guess the answer to your question depends on what you really want to do. I hope this helps a bit.
Mladen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2001 11:26 AM
07-03-2001 11:26 AM
Re: Using the find command to find all executable files.
find / -type f | while read -r file
do
file "$line"
done | grep -e exec -e commands
is supposed to be:
find / -type f | while read -r file
do
file "$file"
done | grep -e exec -e commands
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2001 02:04 PM
07-03-2001 02:04 PM
Re: Using the find command to find all executable files.
Jo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2001 06:26 PM
07-03-2001 06:26 PM
Re: Using the find command to find all executable files.
find / -type f -perm +111
will find all files with any executeable bits set. If you
are runing samba this will include most files on your
shares. You will may miss some scripts that are run
by passing them as arguments to commands
like sh, perl, and awk as they don't need the
execute permission bit set.