006:利用cheat.sh快速了解命令的用法

cheat.sh是一个命令查询网站,在终端中也能够使用。特点是返回的结果是一些非常容易看懂的示例和注解,可以帮助用户快速了解命令的使用方法。

1.语法

curl cheat.sh/command

2.示例

给出一些常用的示例,注解也很容易看懂。此外还会拉取tldr的查询结果。

$ curl cheat.sh/ls

 cheat:ls
# To display everything in <dir>, excluding hidden files:
ls <dir>

# To display everything in <dir>, including hidden files:
ls -a <dir>

# To display all files, along with the size (with unit suffixes) and timestamp:
ls -lh <dir>

# To display files, sorted by size:
ls -S <dir>

...省略...

 tldr:ls
# ls
# List directory contents.
# More information: <https://www.gnu.org/software/coreutils/ls>.

# List files one per line:
ls -1

# List all files, including hidden files:
ls -a

# List all files, with trailing `/` added to directory names:
ls -F

...省略...

3.最终形态 定义为别名

1.编写脚本文件/usr/local/soulio/query_command.sh

#!/bin/bash
curl cheat.sh/$1

2.定义别名

alias qc='bash /usr/local/soulio/query_command.sh'

现在可以用qc command语法来查询命令了

qc ls

3.现在这个别名还仅存在于内存中,重启后就没了。将定义语句添加到~/.bashrc文件中,重启后也能够使用。

alias命令可参考:日常007:alias给长命令起个简短的别名

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值