Linux command to list all available commands and aliases

前端 未结 20 2369
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 14:11

Is there a Linux command that will list all available commands and aliases for this terminal session?

As if you typed \'a\' and pressed tab, but for every letter of

20条回答
  •  半阙折子戏
    2020-11-29 14:43

    You can always to the following:

    1. Hold the $PATH environment variable value.
    2. Split by ":"
    3. For earch entry: 
        ls * $entry 
    4. grep your command in that output.
    

    The shell will execute command only if they are listed in the path env var anyway.

提交回复
热议问题