How do I list all of the executables in a Linux (directory, + sub-dirs, $PATH)?

How can I list all executables (programs) and shell scripts in a directory, sub-directory and/or PATH?

I am not talking about software that was installed with apt-get or any package manager. Using Ubuntu 12.04.


Solution 1:

You can use ls, for example:

ls *.bin *.py

Add any other extensions you wish to list on the command line.

A better way would be to use find, for example:

  1. Do a recursive search from the current directory

    find . -type f -executable
    
  2. Search the current directory

    find . -type f -executable -maxdepth 1
    

Note: The dot after find means search from the current directory. Change it as needed to search from other directories.