 <p>You can use the bash(1) built-in <code>compgen</code></p> <ul> <li><code>compgen -c</code> will list all the commands you could run.</li> <li><code>compgen -a</code> will list all the aliases you could run.</li> <li><code>compgen -b</code> will list all the built-ins you could run.</li> <li><code>compgen -k</code> will list all the keywords you could run.</li> <li><code>compgen -A function</code> will list all the functions you could run.</li> <li><code>compgen -A function -abck</code> will list all the above in one go.</li> </ul> <p>Check the man page for other completions you can generate.</p> <p>To directly answer your question:</p> <pre><code>compgen -ac | grep searchstr </code></pre> <p>should do what yout want.</p>