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给长命令起个简短的别名