I would like to list all commands available in $PATH.

Any idea ?

  • printf '%s\n' ${PATH//:/\/* } – Gilles Quenot Mar 2 '18 at 20:00
  • You can install dmenu_path from suckless-tools, a very nice little application – Cosine Jul 28 '18 at 16:25

Here is a quick onliner that will complete the task as long as you have the rights to view the folders.

for pathitem in $(echo $PATH | sed -e 's/:/ /g'); do echo $pathitem; ls -la $pathitem; echo ""; done

This code will also display the path above the listing and a space underneath it, similar to completing a ls -laR

  • while this would be close, it lists all files in each $PATH directory; maybe there are some files there that aren't executable, and thus shouldn't be considered "commands" – Jeff Schaller Mar 2 '18 at 23:15
  • I was just trying to show a quick one liner for the general idea. – thebtm Mar 2 '18 at 23:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.