在 Linux 上使用 Tealdeer 替代手册页

系统 Linux
手册页是我开始探索 Linux 时最常用的资源。当然,对于初学者熟悉命令行指令而言,man 是最频繁使用的指令。但是手册页中有大量的选项和参数列表,很难被解读,这使得你很难理解你想知道的东西。如果你想要一个更简单的解决方案,有基于例子的输出,我认为 tldr (太长不读)是最好的选择。

Tealder 是 Rust 版本的 tldr,对常用的命令提供了易于理解的说明信息。

手册页是我开始探索 Linux 时最常用的资源。当然,对于初学者熟悉命令行指令而言,man 是最频繁使用的指令。但是手册页中有大量的选项和参数列表,很难被解读,这使得你很难理解你想知道的东西。如果你想要一个更简单的解决方案,有基于例子的输出,我认为 tldr (太长不读too long dnot's read)是最好的选择。

Tealdeer 是什么?

Tealdeer 是 tldr 的一个基于 Rust 的实现。它是一个社区驱动的手册页,给出了非常简单的命令工作原理的例子。Tealdeer 最棒的地方在于它几乎包含了所有你通常会用到的命令。

安装 Tealdeer

在 Linux 系统,你可以从软件仓库安装 Tealdeer,比如在 Fedora 上:

  1. $ sudo dnf install tealdeer

在 macOS 可以使用 MacPorts 或者 Homebrew。 同样,你可以使用 Rust 的 Cargo 包管理器来编译和安装此工具:

  1. $ cargo install tealdeer

使用 Tealdeer

输入 tldr-list 返回 tldr 所支持的手册页,比如 touchtardnfdockerzcatzgrep 等:

  1. $ tldr --list
  2. 2to3
  3. 7z
  4. 7za
  5. 7zr
  6. [
  7. a2disconf
  8. a2dismod
  9. a2dissite
  10. a2enconf
  11. a2enmod
  12. a2ensite
  13. a2query
  14. [...]

使用 tldr 跟上具体的命令(比如 tar )能够显示基于示例的手册页,描述了你可以用该命令做的所有选项。

  1. $ tldr tar
  2.  
  3. Archiving utility.
  4. Often combined with a compression method, such as gzip or bzip2.
  5. More information: <https://www.gnu.org/software/tar>.
  6.  
  7. [c]reate an archive and write it to a [f]ile:
  8.  
  9. tar cf target.tar file1 file2 file3
  10.  
  11. [c]reate a g[z]ipped archive and write it to a [f]ile:
  12.  
  13. tar czf target.tar.gz file1 file2 file3
  14.  
  15. [c]reate a g[z]ipped archive from a directory using relative paths:
  16.  
  17. tar czf target.tar.gz --directory=path/to/directory .
  18.  
  19. E[x]tract a (compressed) archive [f]ile into the current directory [v]erbosely:
  20.  
  21. tar xvf source.tar[.gz|.bz2|.xz]
  22.  
  23. E[x]tract a (compressed) archive [f]ile into the target directory:
  24.  
  25. tar xf source.tar[.gz|.bz2|.xz] --directory=directory
  26.  
  27. [c]reate a compressed archive and write it to a [f]ile, using [a]rchive suffix to determine the compression program:
  28.  
  29. tar caf target.tar.xz file1 file2 file3

如需控制缓存:

  1. $ tldr --update
  2. $ tldr --clear-cache

你能够控制 Tealdeer 输出的颜色选项,有三种模式选择:一直、自动、从不。默认选项是自动,但我喜欢颜色提供的额外信息,所以我在我的 ~/.bashrc文件中增加了这个别名:

  1. alias tldr='tldr --color always'

结论

Tealdeer 的美妙之处在于不需要网络连接就可以使用,只有更新缓存的时候才需要联网。因此,即使你处于离线状态,依然能够查找和学习你新学到的命令。更多信息,请查看该工具的 说明文档。 

 

责任编辑:庞桂玉 来源: Linux中国
相关推荐

2020-04-20 12:18:36

Linux手册页Linux命令

2023-01-28 13:39:31

Linuxzram

2019-12-05 10:30:17

LinuxMultitail

2011-03-22 10:06:27

LinuxZFS

2021-06-15 16:11:51

Linux手册页

2020-10-26 12:30:23

LinuxyumZFS

2020-04-10 09:56:12

at命令Linux安排任务

2021-08-19 18:28:22

FedoraLinuxOpenCV

2019-12-20 08:50:21

LinuxKsnip截图

2019-12-09 14:50:44

LinuxWindow Make桌面

2018-02-26 08:14:20

LinuxDocker容器

2020-05-09 12:01:40

Linux开源软件SDN

2022-07-26 10:13:11

LinuxGNOMERhythmbox

2023-10-15 14:53:22

Arch LinuxYay

2018-09-13 08:00:00

LinuxNetplan网络配置

2018-03-19 19:00:54

2022-01-18 17:57:21

PodmanLinux容器

2021-09-17 10:51:01

Linuxlspci命令

2010-07-02 12:58:39

Meego开发

2021-09-10 10:35:25

Linuxstat命令文件系统
点赞
收藏

51CTO技术栈公众号