Is there a way to get a list of all commands that match a specific (case insensitive) pattern? So for example, I know the command (which might be an alias) I'm looking for contains diag or Diag but I'm not sure of the actual command.I'm currently on Ubuntu with Bash but am asking specifically on this site because I'd love to learn of a way that's usable across various kinds of distros (e.g. I'll need this skill on CentOS and Manjaro later on too).I've tried man iag hoping it would work the same as Powershell's help iag but that doesn't work.I've tried my Google-fu but that only seems to lead to explanations on how to find files by partial name of text inside files.I've tried searching this SE site in various ways (e.g. 1, 2) but didn't find a duplicate of my question.How do you find the exact name of a command if you can remember only part of it?
Find commands by partial name
shell;command line;command
Use compgen -c to get a list of all commands, you can also use it like:compgen -c difto get a list of all commands started with dif.Combine it with grep to get exactly what you are looking for:compgen -c | grep -i diagwhich looks for any commands containing diag. use regex for more flexible searches:compgen -c | grep -i ^diag   # started with diagcompgen -c | grep -i diag$   # ended to diagYou can also use apropos to find commands, it searches into the manual page names and descriptions.