- Community Home
- >
- Servers and Operating Systems
- >
- Operating System - Linux
- >
- General
- >
- Re: dir *.exe ?
-
- Forums
-
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
- HPE Blog, Austria, Germany & Switzerland
- Blog HPE, France
- HPE Blog, Italy
- HPE Blog, Japan
- HPE Blog, Middle East
- HPE Blog, Russia
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
-
Blogs
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Blog, Latin America
- HPE Blog, Middle East
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
-
Information
- Community
- Welcome
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Tips and Tricks
- Resources
- Announcements
- Email us
- Feedback
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Aruba Airheads Community
- Enterprise.nxt
- HPE Dev Community
- Cloud28+ Community
- Marketplace
-
Forums
-
Blogs
-
Information
-
English
- 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
- Email to a Friend
- Report Inappropriate Content
03-31-2004 03:05 PM
03-31-2004 03:05 PM
if i wana see only executable binaries what should i do??
In Windows it is acheived by issuing "dir *.exe"
Regards
Maaz
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-31-2004 03:23 PM
03-31-2004 03:23 PM
Re: dir *.exe ?
man chmod
To list only executable file :
use the perm option of find or display option of ls.
You can also use the command
file *
to get a descritpion of what's in your directory/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-31-2004 03:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-31-2004 03:52 PM
03-31-2004 03:52 PM
Re: dir *.exe ?
for i in *; do if [ -x $i ]; then ll $i; fi; done
-Karthik S S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-31-2004 04:21 PM
03-31-2004 04:21 PM
Re: dir *.exe ?
However, generally speaking, all your binaries are probably in one of a few places. /bin, /usr/bin, /sbin or /usr/local/bin. The common theme here being "bin".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-31-2004 04:36 PM
03-31-2004 04:36 PM
Re: dir *.exe ?
The -x operator is (of course!) also available in perl. For example:
perl -e 'while (<*>) { print "$_\n" if (-x $_) }'
Be sure to check out the 'file' command though as it really 'knows' stuff.
Actually, it does not, but it does a stellar job guessing :-).
file * | awk -F: '/executable/{print $1}'
Using file will also protect against false positives (a text file marked +x) and false negatives (an executable marked -x).
Witness:
# file *
README: ASCII English text
etc_init.d_rexd: Bourne shell script text
kit.LINUX-IA32.tar: GNU tar archive
kit.Tru64UNIX.tar: POSIX tar archive
kit.hpux-ia64.tar: POSIX tar archive
kit.hpux-pa.tar: POSIX tar archive
rex: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dd
rexd: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dd
sbin_init.d_rexd: a /sbin/sh script text
# ls -F * | grep "*"
rex*
rexd*
# perl -e 'while (<*>) { print "$_\n" if (-x $_) }'
rex
rexd
# chmod +x README
# file * | awk -F: '/executable/{print $1}'
rex
rexd
# perl -e 'while (<*>) { print "$_\n" if (-x $_) }'
README
rex
rexd
# chmod -x rex
# perl -e 'while (<*>) { print "$_\n" if (-x $_) }'
README
rexd
# file * | awk -F: '/executable/{print $1}'
rex
rexd
file rules!
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-31-2004 08:19 PM
03-31-2004 08:19 PM
Re: dir *.exe ?
But there is another problem: you can have binaries that are not executable by the user doing the test. You won't see those files, but they might show up if the file command can read them...
Problem with the find command might be it goes down into subdirectories. Something the dir command won't do, unless you specified the /s option.
So, the 'script' would become something like this:
ls -F | grep '[*]$' | sed 's|[*]$||' | while read f
do
if file $f | grep -q executable
then
echo $f
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-01-2004 06:30 PM
04-01-2004 06:30 PM
Re: dir *.exe ?
Many Thanks
Maaz
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2021 Hewlett Packard Enterprise Development LP