1 tldr 介绍
今天发现了一个好玩的命令,该命令会根据二八原则给出命令的常用场景示例,支持在近20种语言环境下运行,通过tldr --update更新本地命令库。什么--help和man都弱爆了。
官网介绍:https://github.com/tldr-pages/tldr
2 tldr命令安装
安装官网提示安装即可,那我选择简单的安装方式,更新
# npm install -g tldr
/home/xiaoxu/node-v10.9.0-linux-x64/bin/tldr -> /home/xiaoxu/node-v10.9.0-linux-x64/lib/node_modules/tldr/bin/tldr
+ tldr@3.2.7
added 113 packages from 103 contributors in 16.052s
3 使用该命令
# tldr tar
tar
Archiving utility.
Often combined with a compression method, such as gzip or bzip.
- Create an archive from files:
tar -cf target.tar file1 file2 file3
- Create a gzipped archive:
tar -czf target.tar.gz file1 file2 file3
- Extract an archive in a target directory:
tar -xf source.tar -C directory
- Extract a gzipped archive in the current directory:
tar -xzf source.tar.gz
- Extract a bzipped archive in the current directory:
tar -xjf source.tar.bz2
- Create a compressed archive, using archive suffix to determine the compression program:
tar -caf target.tar.xz file1 file2 file3
- List the contents of a tar file:
tar -tvf source.tar
- Extract files matching a pattern:
tar -xf source.tar --wildcards "*.html"
4 查看该命令的帮助信息
# tldr -h
Usage: tldr command [options]
Simplified and community-driven man pages
Options:
-V, --version output the version number
-l, --list List all commands for the chosen platform in the cache
-a, --list-all List all commands in the cache
-1, --single-column List single command per line (use with options -l or -a)
-r, --random Show a random command
-e, --random-example Show a random example
-f, --render [file] Render a specific markdown [file]
-m, --markdown Output in markdown format
-o, --os [type] Override the operating system [linux, osx, sunos]
--linux Override the operating system with Linux
--osx Override the operating system with OSX
--sunos Override the operating system with SunOS
-t, --theme [theme] Color theme (simple, base16, ocean)
-s, --search [keywords] Search pages using keywords
-u, --update Update the local cache
-c, --clear-cache Clear the local cache
-h, --help output usage information
Examples:
$ tldr tar
$ tldr du --os=linux
$ tldr --search "create symbolic link to file"
$ tldr --list
$ tldr --list-all
$ tldr --random
$ tldr --random-example
To control the cache:
$ tldr --update
$ tldr --clear-cache
To render a local file (for testing):
$ tldr --render /path/to/file.md