LinuxTOY 是一个致力于提供 Linux 相关资讯的专题站点。如果您发现了好用好玩的 Linux 东东并愿意发扬自由、分享的精神,可以点击顶部导航 Contact 按钮进行投稿。

Related entries

Manpages 彩色版

Manpages 为手册页之意,在 Linux 中,若你遇到问题,可通过 man 指令即时查询这些 Manpages 以获取帮助。Nico Golde 介绍的方法很有意思,它可让我们平时司空见惯的 Manpages 一下子变得充满色彩起来。这个彩色版本的 Manpages 读起来令人感觉更加醒目。

Man
Manpages 彩色版

要实现这个彩色版的 Manpages 并不难,只需按以下步骤执行即可:

  1. 在你的主目录创建 .terminfo 目录,并转到该目录:mkdir ~/.terminfo/ && cd ~/.terminfo
  2. 从作者网站获取 terminfo 描述文件:wget http://nion.modprobe.de/mostlike.txt
  3. 使用 tic 命令编译 mostlike.txt 文件(编译后可删除):tic mostlike.txt
  4. 定义别名:alias man="TERMINFO=~/.terminfo/ LESS=C TERM=mostlike PAGER=less man"

现在使用 man 指令就可以读到彩色版的 Manpages 了。如果你需要修改 terminfo 文件,则可以使用 infocmp mostlike

[via]

署名 • 注明出处 • 非商业性使用

9 Comments

  1. 1 风雷 Commented @ 2007-06-24 10:59 pmReply to this comment

    恩,这个挺有意思的

  2. 2 davix Commented @ 2007-06-24 11:15 pmReply to this comment

    不错,多谢toy的介绍,明天试试

  3. 3 Border Commented @ 2007-06-25 12:27 amReply to this comment

    有空了就去试试。Thanks

  4. 4 nacre Commented @ 2007-06-25 1:38 amReply to this comment

    不用这么麻烦的,在~/.bashrc里添加如下内容就可以了:
    #For colourful man pages (CLUG-Wiki style)
    export LESS_TERMCAP_mb=$’\E[01;31m’
    export LESS_TERMCAP_md=$’\E[01;31m’
    export LESS_TERMCAP_me=$’\E[0m’
    export LESS_TERMCAP_se=$’\E[0m’
    export LESS_TERMCAP_so=$’\E[01;44;33m’
    export LESS_TERMCAP_ue=$’\E[0m’
    export LESS_TERMCAP_us=$’\E[01;32m’

  5. 5 xul Commented @ 2007-06-25 3:31 amReply to this comment

    nacre 的方法不错。

  6. 6 roylez Commented @ 2007-06-25 10:08 amReply to this comment

    Haven’t you guys tried rxvt?

  7. 7 xwl Commented @ 2007-06-25 12:27 pmReply to this comment

    真的想用的话,还不如直接上 most…

    $ PAGER=most man ls

  8. 8 Toy Commented @ 2007-06-25 7:43 pmReply to this comment

    @nacre, xwl:谢谢。

  9. 9 ytao Commented @ 2007-06-26 6:52 pmReply to this comment

    真不错呀!不但看上去是彩色,而且我的man可以使用上下键查看了,不知道是不是也是因为这个缘故。