Finding all executables in a given path is easy if you use the lsx utility. Firstly install the required packages.
jason@eyjafjallajkull:~$ sudo apt-get install suckless-tools [sudo] password for jason: Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: dwm stterm surf The following NEW packages will be installed: suckless-tools 0 to upgrade, 1 to newly install, 0 to remove and 0 not to upgrade. Need to get 49.9 kB of archives. After this operation, 272 kB of additional disk space will be used. Get:1 http://de.archive.ubuntu.com/ubuntu/ vivid/universe suckless-tools amd64 40-1 [49.9 kB] Fetched 49.9 kB in 2s (24.5 kB/s) Selecting previously unselected package suckless-tools. (Reading database ... 386755 files and directories currently installed.) Preparing to unpack .../suckless-tools_40-1_amd64.deb ... Unpacking suckless-tools (40-1) ... Processing triggers for man-db (2.7.0.2-5) ... Setting up suckless-tools (40-1) ... |
Then, once this is installed, you may then use this utility to find all executables in a directory.
jason@eyjafjallajkull:/usr/bin$ lsx /usr/local/bin bundle bundler packettracer |
This is a very useful command for finding executable files easily on your Linux filesystem.
This may also be done with the ls utility. The grep '^\S*x\S*'
command will list only the executable binary files. A neat trick.
deusexmachina:~ jason$ ls -Fla /usr/local/bin/ | grep '^\S*x\S*' drwxrwxr-x 325 jason admin 10400 30 Mar 11:38 ./ drwxr-xr-x 16 root wheel 512 19 Sep 2020 ../ lrwxr-xr-x 1 jason admin 35 13 May 2021 2to3@ -> ../Cellar/python@3.9/3.9.5/bin/2to3 lrwxr-xr-x 1 jason admin 39 13 May 2021 2to3-3.9@ -> ../Cellar/python@3.9/3.9.5/bin/2to3-3.9 lrwxr-xr-x 1 jason admin 37 30 Mar 11:35 aclocal@ -> ../Cellar/automake/1.16.5/bin/aclocal lrwxr-xr-x 1 jason admin 42 30 Mar 11:35 aclocal-1.16@ -> ../Cellar/automake/1.16.5/bin/aclocal-1.16 lrwxr-xr-x 1 jason admin 36 13 May 2021 acountry@ -> ../Cellar/c-ares/1.17.1/bin/acountry lrwxr-xr-x 1 jason admin 32 13 May 2021 adig@ -> ../Cellar/c-ares/1.17.1/bin/adig lrwxr-xr-x 1 jason admin 33 13 May 2021 ahost@ -> ../Cellar/c-ares/1.17.1/bin/ahost lrwxr-xr-x 1 root wheel 89 23 Oct 2018 airport@ -> /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport lrwxr-xr-x 1 jason admin 30 13 May 2021 aomdec@ -> ../Cellar/aom/3.1.0/bin/aomdec lrwxr-xr-x 1 jason admin 30 13 May 2021 aomenc@ -> ../Cellar/aom/3.1.0/bin/aomenc lrwxr-xr-x 1 jason admin 42 13 May 2021 asn1Coding@ -> ../Cellar/libtasn1/4.16.0_1/bin/asn1Coding lrwxr-xr-x 1 jason admin 44 13 May 2021 asn1Decoding@ -> ../Cellar/libtasn1/4.16.0_1/bin/asn1Decoding lrwxr-xr-x 1 jason admin 42 13 May 2021 asn1Parser@ -> ../Cellar/libtasn1/4.16.0_1/bin/asn1Parser lrwxr-xr-x 1 jason admin 36 30 Mar 11:35 autoconf@ -> ../Cellar/autoconf/2.71/bin/autoconf lrwxr-xr-x 1 jason admin 38 30 Mar 11:35 autoheader@ -> ../Cellar/autoconf/2.71/bin/autoheader lrwxr-xr-x 1 jason admin 36 30 Mar 11:35 autom4te@ -> ../Cellar/autoconf/2.71/bin/autom4te lrwxr-xr-x 1 jason admin 38 30 Mar 11:35 automake@ -> ../Cellar/automake/1.16.5/bin/automake lrwxr-xr-x 1 jason admin 43 30 Mar 11:35 automake-1.16@ -> ../Cellar/automake/1.16.5/bin/automake-1.16 lrwxr-xr-x 1 jason admin 36 19 Sep 2020 autopoint@ -> ../Cellar/gettext/0.21/bin/autopoint lrwxr-xr-x 1 jason admin 38 30 Mar 11:35 autoreconf@ -> ../Cellar/autoconf/2.71/bin/autoreconf lrwxr-xr-x 1 jason admin 36 30 Mar 11:35 autoscan@ -> ../Cellar/autoconf/2.71/bin/autoscan lrwxr-xr-x 1 jason admin 38 30 Mar 11:35 autoupdate@ -> ../Cellar/autoconf/2.71/bin/autoupdate lrwxr-xr-x 1 jason admin 34 13 May 2021 aviocat@ -> ../Cellar/ffmpeg/4.4_1/bin/aviocat lrwxr-xr-x 1 jason admin 37 13 May 2021 bd_info@ -> ../Cellar/libbluray/1.3.0/bin/bd_info lrwxr-xr-x 1 jason admin 44 13 May 2021 bd_list_titles@ -> ../Cellar/libbluray/1.3.0/bin/bd_list_titles lrwxr-xr-x 1 jason admin 39 13 May 2021 bd_splice@ -> ../Cellar/libbluray/1.3.0/bin/bd_splice lrwxr-xr-x 1 jason admin 40 13 May 2021 bisect-create@ -> ../Cellar/ffmpeg/4.4_1/bin/bisect-create lrwxr-xr-x 1 jason admin 28 19 Sep 2020 brew@ -> /usr/local/Homebrew/bin/brew lrwxr-xr-x 1 jason admin 41 13 May 2021 cairo-sphinx@ -> ../Cellar/cairo/1.16.0_5/bin/cairo-sphinx lrwxr-xr-x 1 jason admin 40 13 May 2021 cairo-trace@ -> ../Cellar/cairo/1.16.0_5/bin/cairo-trace lrwxr-xr-x 1 root wheel 11 8 Jun 2018 capinfos@ -> ./wireshark |
This version of the command will find all executable binary files that are not symlinks.
deusexmachina:~ jason$ find /usr/local/bin/ -maxdepth 1 -perm -111 -type f /usr/local/bin//wireshark |
This is also a great tip for searching a filesystem for certain binary files.
This version will list only the symlinks.
deusexmachina:~ jason$ find /usr/local/bin/ -maxdepth 1 -perm -111 -type l /usr/local/bin//rubberband /usr/local/bin//lzmainfo /usr/local/bin//unzstd /usr/local/bin//pip3.9 /usr/local/bin//msgconv /usr/local/bin//g-ir-compiler /usr/local/bin//ndiff /usr/local/bin//event_rpcgen.py /usr/local/bin//lame /usr/local/bin//pkg-config /usr/local/bin//gif2rgb /usr/local/bin//pktdumper /usr/local/bin//jemalloc-config /usr/local/bin//msggrep /usr/local/bin//srt-file-transmit /usr/local/bin//tshark /usr/local/bin//sndfile-cmp /usr/local/bin//aclocal /usr/local/bin//ffhash /usr/local/bin//autopoint |
Doing it like this will allow the user to run ls on each search result and get more verbose output.
deusexmachina:~ jason$ find /usr/local/bin/ -maxdepth 1 -perm -111 -type l -exec ls -hula {} \; | head -n 10 lrwxr-xr-x 1 jason admin 41B 13 May 2021 /usr/local/bin//rubberband -> ../Cellar/rubberband/1.9.1/bin/rubberband lrwxr-xr-x 1 jason admin 31B 19 Sep 2020 /usr/local/bin//lzmainfo -> ../Cellar/xz/5.2.5/bin/lzmainfo lrwxr-xr-x 1 jason admin 33B 13 May 2021 /usr/local/bin//unzstd -> ../Cellar/zstd/1.4.9_1/bin/unzstd lrwxr-xr-x 1 jason admin 37B 13 May 2021 /usr/local/bin//pip3.9 -> ../Cellar/python@3.9/3.9.5/bin/pip3.9 lrwxr-xr-x 1 jason admin 34B 19 Sep 2020 /usr/local/bin//msgconv -> ../Cellar/gettext/0.21/bin/msgconv lrwxr-xr-x 1 jason admin 56B 13 May 2021 /usr/local/bin//g-ir-compiler -> ../Cellar/gobject-introspection/1.68.0/bin/g-ir-compiler lrwxr-xr-x 1 jason admin 29B 30 Mar 11:07 /usr/local/bin//ndiff -> ../Cellar/nmap/7.92/bin/ndiff lrwxr-xr-x 1 jason admin 45B 19 Sep 2020 /usr/local/bin//event_rpcgen.py -> ../Cellar/libevent/2.1.12/bin/event_rpcgen.py lrwxr-xr-x 1 jason admin 29B 19 Sep 2020 /usr/local/bin//lame -> ../Cellar/lame/3.100/bin/lame lrwxr-xr-x 1 jason admin 44B 19 Sep 2020 /usr/local/bin//pkg-config -> ../Cellar/pkg-config/0.29.2_3/bin/pkg-config |
The -exec ls -hula {} \;
parameter runs the ls -hula
command on each result found by find.