Linux - Shell script to find particular command, List all available command

Shell script to find particular command

Shell Script to list all linux commands & find particular command

You many want to know whether the particular command is available in your linux machine. In such scenario you can use the below shell script to list all the available commands and grep the required command.

To List all the Commands
  # printf "%s\n" ${PATH//:/\/* }

Script to find the particular command
  # printf "%s\n" ${PATH//:/\/* } | grep 'awk'

Output
  /bin/awk
  /bin/gawk
  /bin/igawk
  /bin/pgawk
  /usr/bin/awk
  /usr/bin/gawk

So from the above output, I confirm that my linux machine has awk, gawk, igawk, pgawk commands.

This is a single line shell script which can be executed from your terminal itself.

The topic on Linux - Shell script to find particular command is posted by - Math

Hope you have enjoyed, Linux - Shell script to find particular commandThanks for your time

Tech Bluff