Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use man help command under Linux

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to use the man help command under Linux. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

1.Linux provides a wealth of help manuals, when you need to check the parameters of a command, you don't have to look around on the Internet, just man it.

All man pages belong to a specific domain, represented by one character.

The most common areas under Linux and their names and descriptions are as follows:

Domain name description

1 user command, which 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 in the / dev directory.

5 description of the file format, such as / etc/passwd.

6 games, no need to explain!

7 Miscellaneous, such as macro command packages, conventions, etc.

8 system administrator tool, which can only be started by root.

9 other (Linux specific) documents used to store kernel routines.

N New documents may have to be moved to a more suitable area.

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

L local documentation, related to this particular system.

Some common parameters and usage of 2.man

The code is as follows:

Man-a cmd

Open help of the same name in all fields, such as man fam, and you will first enter a command version of fam (1m) fam help, and then press the Q key

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

The code is as follows:

Man-aw cmd

Displays the path to all manual files for all cmd, such as man-aw fam is

The code is as follows:

/ usr/share/man/man1/fam.1m.gz

/ usr/share/man/man3/fam.3x.gz

Man domain code cmd

Directly specify the search man pages within a specific domain, such as man 3 fam directly into the library function version of the help

The code is as follows:

Man-M cmd

Specify the search path for manual files, such as man-M / home/mysql/man mysql, which shows the help of the mysql you installed

Instead of the help of the old mysql that comes with the system.

The code is as follows:

Man cmd | col-b > cmd.txt

Output man manual information to a text file

LANG= language code

The code is as follows:

Man-w cmd

The path to man language-specific manpage files

View man pages for a specific language version

For example, to view the Chinese man of mplayer

The code is as follows:

Shell > LANG=zh

Shell > man-w mplayer

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

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

The code is as follows:

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

By default, 3.ubuntu does not install the library function man manual in c language.

(1)。 Add Library function Manual

Ubuntu does not install the man manual of library functions in c by default, so you will show that there is no documentation when you use functions such as man perror and sendto, which has depressed me for a long time. Solution:

The code is as follows:

Sudo apt-get install manpages-dev

(2)。 Let man display Chinese

The Chinese man package is already included in the ubuntu source, so there is no need to down from other places, directly

The code is as follows:

Sudo apt-get install manpages-zh

But in this way, man does not display Chinese by default, so you need the following two steps

a. Convert Chinese man package to utf8 format

Create a new script file

The code is as follows:

Gedit t.sh

Add the following

The code is as follows:

#! / bin/bashcd / usr/share/man/zh_CN/for k in * docd $kfor i in * .gzdo j = `echo ${i%.gz} `gunzip $I iconv-f gb18030-t utf8 $j > tmp mv tmp $j gzip $jdonecd.. done

And then

The code is as follows:

Sudo. / t

b. Modify the default language of man

The code is as follows:

Sudo gedit / etc/manpath.config

Change all / usr/share/man in it to / usr/share/man/zh_CN

Save and exit, and then you try man ls again

(3)。 Let those who have no Chinese help display English.

It is not enough to finish the second part above. When you man some of the c language functions (do not use the more famous functions such as printf,socket, which have already been helped in Chinese), you will find that it does not help, and it has already been installed in the first step. This is because your above operation to change / usr/share/man to / usr/share/man/zh_CN makes man search only in Chinese help, and if not, give up directly, so you need the following operations to make man automatically display English help when there is no Chinese help, if there is no English help, there is really no help.

The code is as follows:

Sudo gedit / etc/manpath.config

Then search for the place you just changed, and then add the same line after it, except that the following directory still uses the original / usr/share/man, such as the modified

The code is as follows:

MANPATH_MAP / bin / usr/share/man/zh_CN

Add another line

The code is as follows:

MANPATH_MAP / bin / usr/share/man

If you find that many man pages are missing from the installed system.

It was done with the following command

The code is as follows:

Sudo apt-get install manpages

Sudo apt-get install manpages-de

Sudo apt-get install manpages-de-dev

Sudo apt-get install manpages-dev

This is the end of this article on "how to use man help commands under Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report