Use full parsing for man help commands in CentOS

Source: Internet
Author: User
Tags fam

Use full parsing for man help commands in CentOS
This article mainly introduces the use of man help commands in Linux, which is the basic knowledge of Linux beginners. For more information, see

1. Linux provides a wide range of help manuals. When you need to view the parameters of a command, you don't have to go online to search for it. Just man.

All the manual pages belong to a specific field and are represented by one character.

The most common fields in Linux and their names and descriptions are as follows:

Domain Name Description

1. USER commands can be started by anyone.

2. system calls, that is, functions provided by the kernel.

3 routines, that is, library functions.

4 devices, that is, special files under the/dev directory.

5. file format description, for example,/etc/passwd.

6 games, no need to explain!

7 Miscellaneous, such as macro command packages and conventions.

8. The system administrator tool can only be started by the root user.

9 others (Linux-specific) are used to store documents of kernel routines.

N new documents may need to be moved to a more appropriate area.

O old documents may be retained for a period of time.

L local documents related to the specific system.

2. Some common parameters and usage of man

Man-a cmd

Open the help with the same name in all fields, such as man fam, you will first enter a fam (1 M) command version fam help, you then press the q key

Will enter FAM (3X), library function version help

Man-aw cmd

Shows the path of all the cmd manual files, such as man-aw fam.

/Usr/share/man/man1/fam.1m.gz </p> <p>/usr/share/man/man3/fam.3x.gz


Man domain code cmd

Directly specify the manual page for search in a specific field, such as man 3 fam.

Man-M cmd

Specify the search path of the manual file, such as man-M/home/mysql/man mysql,

Instead of the help of the old mysql version that comes with the System

Man cmd | col-B> cmd.txt

Output man manual information to a text file

LANG = language code

Man-w cmd

Manpage file path in man-specific language

View the manual page for a specific language version

For example, to view the Chinese man of mplayer

Shell> LANG = zh </p> <p> shell> man-w mplayer </p> <p>/usr/share/man/zh/man1/mplayer.1.gz

Open a new shell window (or in the original window shell> LANG = en_US.UTF-8)

Shell> man/usr/share/man/zh/man1/mplayer.1.gz

3. ubuntu does not have the library function man manual for C language installed by default.

(1). Add library function manual
Ubuntu does not have the man manual for library functions installed in C language by default. Therefore, when you use functions such as man perror and sendto, no relevant documentation is displayed, this problem has left me depressed for a long time. Solution:

Sudo apt-get install manpages-dev

(2) show man Chinese Characters
The ubuntu source already contains a Chinese man package, so you don't need to go down from other places.

Sudo apt-get install manpages-zh

However, man does not display Chinese characters by default. The following two steps are required:
A. Convert the Chinese man package to utf8 format
Create a script file

Gedit t. sh

Add the following content

#! /Bin/bashcd/usr/share/man/zh_CN/for k in * docd $ kfor I in *. gzdo j = 'echo your i0000.gz} 'gunzip $ I iconv-f gb18030-t utf8 $ j> tmp mv tmp $ j gzip $ jdonmcm .. done

Then

Sudo./t

B. Modify man's default language

Sudo gedit/etc/manpath. config </p> <p>

Change/usr/share/man to/usr/share/man/zh_CN.
Save and exit. Then try man ls again.
(3). Display English without help from Chinese Characters
It is not enough to finish the second part. At this time, you need to man some C language functions (do not use some famous functions such as printf and socket, which have already helped Chinese) the first step has been installed. This is because you changed/usr/share/man to/usr/share/man/zh_CN so that man can only search in Chinese help. If not, give up directly, therefore, the following operations are required to enable man to automatically display help in English when there is no help in Chinese.

Sudo gedit/etc/manpath. config

Then, search for the change you just made and add the same line to the end of the change, but the following directory still uses the original/usr/share/man, for example, the modified

MANPATH_MAP/bin/usr/share/man/zh_CN

Add another row

MANPATH_MAP/bin/usr/share/man

If many manual pages are missing from the installed system.
Run the following command.

Sudo apt-get install manpages
Sudo apt-get install manpages-de
Sudo apt-get install manpages-de-dev
Sudo apt-get install manpages-dev

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.