linux如何列出所有命令,Linux命令列出所有可用的命令和别名

Alternatively, you can get a convenient list of commands coupled with quick descriptions (as long as the command has a man page, which most do):

apropos -s 1 ''

-s 1 returns only "section 1" manpages which are entries for executable programs.

'' is a search for anything. (If you use an asterisk, on my system, bash throws in a search for all the files and folders in your current working directory.)

Then you just grep it like you want.

apropos -s 1 '' | grep xdg

yields:

xdg-desktop-icon (1) - command line tool for (un)installing icons to the desktop

xdg-desktop-menu (1) - command line tool for (un)installing desktop menu items

xdg-email (1) - command line tool for sending mail using the user's preferred e-mail composer

xdg-icon-resource (1) - command line tool for (un)installing icon resources

xdg-mime (1) - command line tool for querying information about file type handling and adding descriptions for new file types

xdg-open (1) - opens a file or URL in the user's preferred application

xdg-screensaver (1) - command line tool for controlling the screensaver

xdg-settings (1) - get various settings from the desktop environment

xdg-user-dir (1) - Find an XDG user dir

xdg-user-dirs-update (1) - Update XDG user dir configuration

The results don't appear to be sorted, so if you're looking for a long list, you can throw a | sort | into the middle, and then pipe that to a pager like less/more/most. ala:

apropos -s 1 '' | sort | grep zip | less

Which returns a sorted list of all commands that have "zip" in their name or their short description, and pumps that the "less" pager. (You could also replace "less" with $PAGER and use the default pager.)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值