<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: dir *.exe ? in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/dir-exe/m-p/3236213#M73715</link>
    <description>did you want to list 'real executables' or executable shell scripts also?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The -x operator is (of course!) also available in perl. For example:&lt;BR /&gt;&lt;BR /&gt;perl -e 'while (&amp;lt;*&amp;gt;) { print "$_\n" if (-x $_) }'&lt;BR /&gt;&lt;BR /&gt;Be sure to check out the 'file' command though as it really 'knows' stuff. &lt;BR /&gt;Actually, it does not, but it does a stellar job guessing :-).&lt;BR /&gt;&lt;BR /&gt;file * | awk -F: '/executable/{print $1}'&lt;BR /&gt;&lt;BR /&gt;Using file will also protect against false positives (a text file marked +x) and false negatives (an executable marked -x).&lt;BR /&gt;Witness:&lt;BR /&gt;&lt;BR /&gt;# file *&lt;BR /&gt;README:             ASCII English text&lt;BR /&gt;etc_init.d_rexd:    Bourne shell script text&lt;BR /&gt;kit.LINUX-IA32.tar: GNU tar archive&lt;BR /&gt;kit.Tru64UNIX.tar:  POSIX tar archive&lt;BR /&gt;kit.hpux-ia64.tar:  POSIX tar archive&lt;BR /&gt;kit.hpux-pa.tar:    POSIX tar archive&lt;BR /&gt;rex:                ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dd&lt;BR /&gt;rexd:               ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dd&lt;BR /&gt;sbin_init.d_rexd:   a /sbin/sh script text&lt;BR /&gt;&lt;BR /&gt;# ls -F * | grep "*"&lt;BR /&gt;rex*&lt;BR /&gt;rexd*&lt;BR /&gt;&lt;BR /&gt;# perl -e 'while (&amp;lt;*&amp;gt;) { print "$_\n" if (-x $_) }'&lt;BR /&gt;rex&lt;BR /&gt;rexd&lt;BR /&gt;&lt;BR /&gt;# chmod +x README&lt;BR /&gt;# file * | awk -F: '/executable/{print $1}'&lt;BR /&gt;rex&lt;BR /&gt;rexd&lt;BR /&gt;&lt;BR /&gt;# perl -e 'while (&amp;lt;*&amp;gt;) { print "$_\n" if (-x $_) }'&lt;BR /&gt;README&lt;BR /&gt;rex&lt;BR /&gt;rexd&lt;BR /&gt;&lt;BR /&gt;# chmod -x rex&lt;BR /&gt;# perl -e 'while (&amp;lt;*&amp;gt;) { print "$_\n" if (-x $_) }'&lt;BR /&gt;README&lt;BR /&gt;rexd&lt;BR /&gt;&lt;BR /&gt;# file * | awk -F: '/executable/{print $1}'&lt;BR /&gt;rex&lt;BR /&gt;rexd&lt;BR /&gt;&lt;BR /&gt;file rules!&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt; &lt;BR /&gt;</description>
    <pubDate>Thu, 01 Apr 2004 00:36:44 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2004-04-01T00:36:44Z</dc:date>
    <item>
      <title>dir *.exe ?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/dir-exe/m-p/3236208#M73710</link>
      <description>Hi&lt;BR /&gt;if i wana see only executable binaries what should i do??&lt;BR /&gt;In Windows it is acheived by issuing "dir *.exe"&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Maaz</description>
      <pubDate>Wed, 31 Mar 2004 23:05:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/dir-exe/m-p/3236208#M73710</guid>
      <dc:creator>Maaz</dc:creator>
      <dc:date>2004-03-31T23:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: dir *.exe ?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/dir-exe/m-p/3236209#M73711</link>
      <description>Unix or Linux doesn't rely on file extension. To make a file executable, you just set the executable bit on it.&lt;BR /&gt;man chmod&lt;BR /&gt;To list only executable file : &lt;BR /&gt;use the perm option of find or display option of ls. &lt;BR /&gt;You can also use the command &lt;BR /&gt;file *&lt;BR /&gt;to get a descritpion of what's in your directory/</description>
      <pubDate>Wed, 31 Mar 2004 23:23:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/dir-exe/m-p/3236209#M73711</guid>
      <dc:creator>Nicolas Dumeige</dc:creator>
      <dc:date>2004-03-31T23:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: dir *.exe ?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/dir-exe/m-p/3236210#M73712</link>
      <description>Hello Maaz,&lt;BR /&gt;&lt;BR /&gt;ls -F | grep '*' is one way to do it.&lt;BR /&gt;&lt;BR /&gt;Greetings, Martin&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 31 Mar 2004 23:36:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/dir-exe/m-p/3236210#M73712</guid>
      <dc:creator>Martin P.J. Zinser</dc:creator>
      <dc:date>2004-03-31T23:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: dir *.exe ?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/dir-exe/m-p/3236211#M73713</link>
      <description>This will list you all the executables under the current directory,&lt;BR /&gt;&lt;BR /&gt;for i in *; do if [ -x $i ]; then ll $i; fi; done&lt;BR /&gt;&lt;BR /&gt;-Karthik S S</description>
      <pubDate>Wed, 31 Mar 2004 23:52:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/dir-exe/m-p/3236211#M73713</guid>
      <dc:creator>Karthik S S</dc:creator>
      <dc:date>2004-03-31T23:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: dir *.exe ?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/dir-exe/m-p/3236212#M73714</link>
      <description>Theonly way you can really be sure is to do "file &lt;FILENAME&gt;" and read the output.&lt;BR /&gt; &lt;BR /&gt;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".&lt;/FILENAME&gt;</description>
      <pubDate>Thu, 01 Apr 2004 00:21:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/dir-exe/m-p/3236212#M73714</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-04-01T00:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: dir *.exe ?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/dir-exe/m-p/3236213#M73715</link>
      <description>did you want to list 'real executables' or executable shell scripts also?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The -x operator is (of course!) also available in perl. For example:&lt;BR /&gt;&lt;BR /&gt;perl -e 'while (&amp;lt;*&amp;gt;) { print "$_\n" if (-x $_) }'&lt;BR /&gt;&lt;BR /&gt;Be sure to check out the 'file' command though as it really 'knows' stuff. &lt;BR /&gt;Actually, it does not, but it does a stellar job guessing :-).&lt;BR /&gt;&lt;BR /&gt;file * | awk -F: '/executable/{print $1}'&lt;BR /&gt;&lt;BR /&gt;Using file will also protect against false positives (a text file marked +x) and false negatives (an executable marked -x).&lt;BR /&gt;Witness:&lt;BR /&gt;&lt;BR /&gt;# file *&lt;BR /&gt;README:             ASCII English text&lt;BR /&gt;etc_init.d_rexd:    Bourne shell script text&lt;BR /&gt;kit.LINUX-IA32.tar: GNU tar archive&lt;BR /&gt;kit.Tru64UNIX.tar:  POSIX tar archive&lt;BR /&gt;kit.hpux-ia64.tar:  POSIX tar archive&lt;BR /&gt;kit.hpux-pa.tar:    POSIX tar archive&lt;BR /&gt;rex:                ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dd&lt;BR /&gt;rexd:               ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dd&lt;BR /&gt;sbin_init.d_rexd:   a /sbin/sh script text&lt;BR /&gt;&lt;BR /&gt;# ls -F * | grep "*"&lt;BR /&gt;rex*&lt;BR /&gt;rexd*&lt;BR /&gt;&lt;BR /&gt;# perl -e 'while (&amp;lt;*&amp;gt;) { print "$_\n" if (-x $_) }'&lt;BR /&gt;rex&lt;BR /&gt;rexd&lt;BR /&gt;&lt;BR /&gt;# chmod +x README&lt;BR /&gt;# file * | awk -F: '/executable/{print $1}'&lt;BR /&gt;rex&lt;BR /&gt;rexd&lt;BR /&gt;&lt;BR /&gt;# perl -e 'while (&amp;lt;*&amp;gt;) { print "$_\n" if (-x $_) }'&lt;BR /&gt;README&lt;BR /&gt;rex&lt;BR /&gt;rexd&lt;BR /&gt;&lt;BR /&gt;# chmod -x rex&lt;BR /&gt;# perl -e 'while (&amp;lt;*&amp;gt;) { print "$_\n" if (-x $_) }'&lt;BR /&gt;README&lt;BR /&gt;rexd&lt;BR /&gt;&lt;BR /&gt;# file * | awk -F: '/executable/{print $1}'&lt;BR /&gt;rex&lt;BR /&gt;rexd&lt;BR /&gt;&lt;BR /&gt;file rules!&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Thu, 01 Apr 2004 00:36:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/dir-exe/m-p/3236213#M73715</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-04-01T00:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: dir *.exe ?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/dir-exe/m-p/3236214#M73716</link>
      <description>It depends on your definition of executable binaries... Using the -x option or looking at the permissions is not enough if you're not interested in shell scripts or data files that have the execute bit on by accident.&lt;BR /&gt;&lt;BR /&gt;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...&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;So, the 'script' would become something like this:&lt;BR /&gt;ls -F | grep '[*]$' | sed 's|[*]$||' | while read f&lt;BR /&gt;do&lt;BR /&gt;if file $f | grep -q executable&lt;BR /&gt;then&lt;BR /&gt;echo $f&lt;BR /&gt;fi&lt;BR /&gt;done</description>
      <pubDate>Thu, 01 Apr 2004 04:19:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/dir-exe/m-p/3236214#M73716</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2004-04-01T04:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: dir *.exe ?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/dir-exe/m-p/3236215#M73717</link>
      <description>Hi Gurus, ...So Nice of u all&lt;BR /&gt;Many Thanks&lt;BR /&gt;&lt;BR /&gt;Maaz</description>
      <pubDate>Fri, 02 Apr 2004 02:30:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/dir-exe/m-p/3236215#M73717</guid>
      <dc:creator>Maaz</dc:creator>
      <dc:date>2004-04-02T02:30:59Z</dc:date>
    </item>
  </channel>
</rss>

