当我们在ubuntu下使用命令,常常需要用到man命令来帮助查看命令参数的意义。但是我们的英文水平不一,因此好多英文解释根本看不懂。

比如用该命令查看 vi 的帮助,纯英文很难懂:

root@iZ235o7pur2Z:~# man vi
VIM(1)                                                                                                                                                                                                                          VIM(1)

NAME
       vim - Vi IMproved, a programmers text editor

SYNOPSIS
       vim [options] [file ..]
       vim [options] -
       vim [options] -t tag
       vim [options] -q [errorfile]

       ex
       view
       gvim gview evim eview
       rvim rview rgvim rgview

DESCRIPTION
       Vim is a text editor that is upwards compatible to Vi.  It can be used to edit all kinds of plain text.  It is especially useful for editing programs.

       There  are  a  lot  of enhancements above Vi: multi level undo, multi windows and buffers, syntax highlighting, command line editing, filename completion, on-line help, visual selection, etc..  See ":help vi_diff.txt" for a
       summary of the differences between Vim and Vi.

       While running Vim a lot of help can be obtained from the on-line help system, with the ":help" command.  See the ON-LINE HELP section below.

       Most often Vim is started to edit a single file with the command

            vim file

       More generally Vim is started with:

            vim [options] [filelist]

       If the filelist is missing, the editor will start with

其实ubuntu有man的中文包,只需几行命令安装配置即可显示中文帮助。命令如下:

apt-get install manpages-zh
vi /etc/manpath.config
:1,$s#/usr/share/man#/usr/share/man/zh_CN#g

以上3行命令即可搞定。

第一个命令:下载man帮助的中文包

第二个命令:用vi编辑man的配置文件

第三个命令:将所有的/usr/share/man替换为/usr/share/man/zh_CN,

:1,$s#/usr/share/man#/usr/share/man/zh_CN#g

说明:

1.在用 vi 命令编辑文件,使用命令前先按:键,然后输入命令1,$s#/usr/share/man#/usr/share/man/zh_CN#g,回车即可

2.替换第 1 行开始到最后一行中所有的 /usr/share/man 为 /usr/share/man/zh_CN


这样配置好后,再次运行命令就能看到中文帮助了


root@iZ23pe9qfubZ:~# man vi
VIM(1)                                                                                                                                                                                                                          VIM(1)

NAME
       vim - Vi IMproved, 一个程序员的文本编辑器

总览 (SYNOPSIS)
       vim [options] [file ..]
       vim [options] -
       vim [options] -t tag
       vim [options] -q [errorfile]

       ex
       view
       gvim gview
       rvim rview rgvim rgview

描述 (DESCRIPTION)
       Vim 是 一个 同 Vi 向上兼容的 文本 编辑器, 可以 用来 编辑 任何 ASCII 文本, 特别 适合 用来 编辑 程序.

       它对 Vi 作了 许多 增强: 多层撤销, 多窗口, 多缓冲区(buffer), 高亮度 语法显示, 命令行编辑, 文件名匹配, 在线帮助, 可视选定, 等等. 用 ":help vi_diff.txt" 看 Vim 和 Vi 的差别 的 摘要.

       在运行 Vim 的时候 可以用 ":help" 命令 获得 很多 帮助.  参考 下面的 在线帮助 一节.

       一般 可用

            vim file

       命令 打开 Vim 来 编辑 一个 文件. 概括的说, 可以

(转载本站原创文章请注明作者与出处Coding云--codingyun.com)

打赏
  • 微信
  • 支付宝

评论
来发评论吧~