如何获取所有可用shell命令的列表

Dav*_*ter 7 bash shell

在典型的Linux shell(bash)中,可以按Tab键两次,以获取所有可用shell命令的列表.

是否有一个具有相同行为的命令?我想把它管道grep并搜索它.

小智 9

你可以使用compgen.例如:

compgen -c
Run Code Online (Sandbox Code Playgroud)

你也可以grep它,像这样:

compgen -c | grep top$
Run Code Online (Sandbox Code Playgroud)

资料来源:http://www.cyberciti.biz/open-source/command-line-hacks/compgen-linux-command/