如何获得所有可用的Shell命令的列表 [英] How do I get a list of all available shell commands

查看:47
本文介绍了如何获得所有可用的Shell命令的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在典型的Linux shell(bash)中,可以两次单击tab键,以获得所有可用的shell命令的列表.

In a typical Linux shell (bash) it is possible to to hit tab twice, to get a list of all available shell commands.

是否存在具有相同行为的命令?我想将其传送到 grep 并进行搜索.

Is there a command which has the same behaviour? I want to pipe it into grep and search it.

推荐答案

您可以使用compgen.例如:

You could use compgen. For example:

compgen -c

您也可以像这样对它进行grep:

You also could grep it, like this:

compgen -c | grep top$

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

这篇关于如何获得所有可用的Shell命令的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆