在 Linux 上用 Tealdeer 替换手册页
Tealdeer 是 tldr 的 Rust 实现,它提供了有关常用命令的易于理解的信息。
当我开始探索 Linux 时,手册页是我的首选资源。当然,当初学者开始熟悉命令行世界时,man 是最常用的命令。但是手册页中包含大量的选项和参数,可能很难解读,这使得您很难理解您想知道的任何内容。如果您想要一个带有基于示例的输出的更简单的解决方案,我认为 tldr 是最好的选择。
蒂尔德尔是什么?
Tealdeer 是 Rust 中 tldr 的一个精彩实现。这是一个社区驱动的手册页,提供了有关命令如何工作的非常简单的示例。 Tealdeer 最好的部分是它几乎拥有您通常使用的所有命令。
安装 Tealdeer
在 Linux 上,您可以从软件存储库安装 Tealdeer。例如,在 Fedora 上:
$ sudo dnf install tealdeer在 macOS 上,使用 MacPorts 或 Homebrew。
或者,您可以使用 Rust 的 Cargo 包管理器构建并安装该工具:
$ cargo install tealdeer使用青鹿
输入 tldr --list 返回 tldr 支持的手册页列表,例如 touch、tar、dnf、<代码>docker、zcat、zgrep等:
$ tldr --list
2to3
7z
7za
7zr
[
a2disconf
a2dismod
a2dissite
a2enconf
a2enmod
a2ensite
a2query
[...]将 tldr 与特定命令(例如 tar)结合使用会显示基于示例的手册页,其中描述了您可以使用该命令执行的所有选项:
$ tldr tar
Archiving utility.
Often combined with a compression method, such as gzip or bzip2.
More information: <https://www.gnu.org/software/tar>.
[c]reate an archive and write it to a [f]ile:
tar cf target.tar file1 file2 file3
[c]reate a g[z]ipped archive and write it to a [f]ile:
tar czf target.tar.gz file1 file2 file3
[c]reate a g[z]ipped archive from a directory using relative paths:
tar czf target.tar.gz --directory=path/to/directory .
E[x]tract a (compressed) archive [f]ile into the current directory [v]erbosely:
tar xvf source.tar[.gz|.bz2|.xz]
E[x]tract a (compressed) archive [f]ile into the target directory:
tar xf source.tar[.gz|.bz2|.xz] --directory=directory
[c]reate a compressed archive and write it to a [f]ile, using [a]rchive suffix to determine the compression program:
tar caf target.tar.xz file1 file2 file3控制缓存:
$ tldr --update
$ tldr --clear-cache您可以使用 --color 选项为 Tealdeer 输出提供一些颜色,将其设置为 always、auto 和 never >。默认值为 auto,但我喜欢添加的上下文颜色,因此我通过将以下内容添加到我的 ~/.bashrc 文件中使我的颜色永久化:
alias tldr='tldr --color always'结论
Tealdeer 的优点在于您不需要网络连接即可使用它,除非您更新缓存。因此,即使您处于离线状态,您仍然可以搜索并了解您最喜欢的新命令。有关更多信息,请参阅该工具的文档。
你会使用Tealdeer吗?或者你已经在使用它了?请在下面的评论中告诉我们您的想法。
