我是终端的新手,我想知道是否有一种方法可以在终端中找到特定的命令名,而不是试图在网上或通过各种站点查找它们。
我喜欢--help和man对我所知道的命令的支持,但我想看看有哪些命令,并发现新的命令。
发布于 2015-11-04 22:54:17
有一个名为bash的compgen,它可以显示所有可能的完成,这意味着您可以看到启用完成的所有命令。
要查看所有由您运行的命令,您可以这样做:
compgen -c如果希望找到所有命令的名称中都有例如bash,则可以这样做:
$ compgen -c | grep 'bash'
dh_bash-completion
bashbug
bash
rbash下面是您可以在compgen中使用的选项列表:
alias Alias names. Specified as -a.
builtin Names of shell builtin commands. Specified as -b.
command Command names. Specified as -c.
directory Directory names. Specified as -d.
export Names of exported shell variables. Specified as -e.
file File names. Specified as -f.
function Names of shell functions.
group Group names. Specified as -g.
job Job names, if job control is active. Specified as -j.
keyword Shell reserved words. Specified as -k.
service Service names. Specified as -s.
user User names. Specified as -u.
variable Names of all shell variables. Specified as -v.compgen通过-A选项接受更多参数。检查compgen和complete条目从man bash获得更多的想法。
https://askubuntu.com/questions/694040
复制相似问题