- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- dir *.exe ?
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
Discussions
Discussions
Forums
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
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
тАО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
- 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
- Report Inappropriate Content
тАО03-31-2004 03:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- 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
- 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
- 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
- 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
- Report Inappropriate Content
тАО04-01-2004 06:30 PM
тАО04-01-2004 06:30 PM
Re: dir *.exe ?
Many Thanks
Maaz