Starting from the man command (info Introduction), maninfo

Source: Internet
Author: User

Starting from the man command (info Introduction), maninfo

Preface

Xiao Sheng believes that the learning of all commands should start with help and gain a deep understanding of its functions. Even in actual projects, we cannot do without it. Because we may not be able to remember all the relevant functions of all commands, it is our best choice to view the help of commands.

Body

  Next, let's take a look at the man and info commands.

First, we can use the man command to view the instructions. Some friends may not be very good at English and want to master linux commands as soon as possible. We can download the Chinese man help manual and set the alias (such as cman) after installation ), you can use it to display Chinese characters (follow the next blog for installation ). However, it is recommended that you do not rely too much on the Chinese manual. It is king to read the English document.

Man (1) NAME man-format and display the on-line manual pagesMANUAL SECTIONS The standard sections of the manual include: 1 User Commands // standard command --- the command that the User can execute in the shell environment or the executable file 2 System CILS // System Call --- functions (such as open and write) provided by the kernel, view the header file) 3 C Library Functions // C function --- (printf, fread) 4 Devices and Special Files // device and Special File description --- usually File 5 File Formats and Conventions under/dev // File format and Conventions --- configuration File or some File Formats such passwd 6 Games et. al. // games and other entertainment --- reserved for games, 7 Miscellanea // miscellaneous defined by each game --- such as man, environ, Linux file System, network protocol, ASCII code description 8 System Administration tools and Deamons // available management by the System administrator command --- ifconfig

For example:

[Linux @ linux ~] $ Man printf -- default PRINTF (1) in the upper left corner, which is the command in shell [linux @ linux ~] $ Man 3 printf -- represents a function in C Language

Man page consists of the following parts:


NAME
Brief Instructions and data name descriptions
SYNOPSIS Instruction issuing syntax
DESCRIPTION Complete and detailed instructions !!
AUTHOR Author
REPORTING BUGS Feedback Error
COPYRIGHT Copyright
SEE ALSO Instructions

 

 

 

 

 

 

 

 

 

Buttons in the help document

Buttons Action
SPACE Flip down
Page Down Flip down arrow keys move down
Page Up Move up
Home Back to homepage
End Go to the last page
/String Search down strings
? String Search up strings
N, N View the next or last searched string, And/string ,? String
Q Exit

 

 

 

 

 

 

 

 

View All description files starting with a keyword

1 [linux@linux ~]$ man -f man2 man                  (1)  - format and display the on-line manual pages3 man                  (1p)  - display system documentation4 man                  (7)  - macros to format man pages5 man.config [man]     (5)  - configuration data for man6 man [manpath]        (1)  - format and display the on-line manual pages7 man-pages            (7)  - conventions for writing Linux man pages

 

The related instructions are displayed based on the keywords (not necessarily the beginning ).

1 [linux@linux ~]$ man -k man2 ...3 xsetwacom            (1)  - commandline utility to query and modify wacom driver settings4 xsltproc             (1)  - command line XSLT processor5 yum-groups-manager   (1)  - create and edit yum's group metadata

After executing the command, we can find that the man keyword in the last column is also listed. This is not what we want. Therefore, I think of the cut and grep commands (cut and grep) used by laruence in the following chapters ), this is the result of the first reading, know the relevant commands, and then find and implement them.

1 [linux@linux ~]$ man -k man | cut -d ' ' -f 1 | grep 'man'2 cmakecommands3 command4 command5 ecryptfs-manager6 ...

You can also execute commands in man ----! Command

For man-related parameter descriptions, I refer to the http://www.cnblogs.com/chengmo blog, which is now referenced below.

Syntax:

Man [-adfhktwW] [section] [-M path] [-P pager] [-S list] [-m system] [-p string] title ..

Parameter usage:

 

Parameters Remarks
Common man commands
- Show all matching items
-D Searches for the path information when displaying man's Manual document. The manual page content is not displayed.
-D Same as-d. The content on the manual page is displayed.
-F In the same command as whatis, the help index information with the same keyword is searched in the whatis database.
-H Show Help Information
-K The same command as apropos will search for the whatis database and fuzzy search for keywords
-S list Specify the search fields and sequence, for example,-S 1: 1 p httpd will search man1 and then man1p directory
-T Use the troff command to format the output manual page. Default Value: groff output format page.
-W Without search title print manpath variable with title Keyword print find manual file path, by default search for a file and then stop
-W Same as-w
Section Search field [limited manual type] All manuals are searched by default
Other parameters of the man command
-C Displays the manual information for using cat commands.
-C Specify the man command to search for the configuration file. The default value is man. config.
-K Searching a string on all manual pages is slow
-M Specify the path of the search Manual
-P pro Use the program pro to display the manual page. The default value is less.
-B pro Use the pro program to display the HTML manual page. The default value is less.
-H pro Use the pro program to read the HTML manual and display it in txt format. The default value is cat.
-P str Specify to format the manual by using other programs before using groff
  • Man command for help

 

Instance code

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 [chengmo@centos5 ~]$ man -w passwd/usr/share/man/man1/passwd.1.gz# Display the path of the passwd help file. passwd.1 indicates by name that this is the help manual of the passwd command. What about other commands of passwd? [chengmo@centos5 ~]$ man -aw passwd/usr/share/man/man1/passwd.1.gz/usr/share/man/man5/passwd.5.gz# Add-a. Obtain the address of all help manual files. By default, only one [chengmo@centos5 ~]$ man 5 passwd# Only obtain the passwd configuration file help information. You can add the domain type restriction. If you know 5, the default is to query the man5 file configuration information instruction manual directory.[chengmo@centos5 ~]$ man -d passwdReading config file /etc/man.config.....found man directory /usr/manusing /usr/bin/less -is as pagerusing /usr/bin/less -is as browserusing /bin/cat to dump HTML pages as textpath directory /bin is in the config fileadding /usr/share/man/zh_CN to manpathadding /usr/share/man to manpathfound 'NROFF_OLD_CHARSET' in pathold charset of '/usr/share/man/man1/passwd.1.gz' is 'ISO-8859-1'man: not executing command:  (cd /usr/share/man && (echo ".ll 11.8i"; echo ".nr LL 11.8i"; echo ".pl 1100i"; /usr/bin/gunzip -c '/usr/share/man/man1/passwd.1.gz'; echo ".\\\""; echo ".pl \n(nlu+10") | /usr/bin/gtbl | /usr/bin/nroff -c --legacy ISO-8859-1 -mandoc 2>/dev/null | /usr/bin/less -is) # Man-d returns man's search and search method during execution, and how to display the query manual by formatting the statement. Will be listed# You can see that the zh_CN Directory Search is added because of the current LANG = zh_CN.gb2312 and the html output file and search path corresponding to the specified pages and borw.output commands.# When the command is finally executed, a series of format conversion commands will eventually show less[chengmo@centos5 ~]$ man -S 1:2 passwd# The fields are as follows: 1: 2. The corresponding directories are man1 and man2.[chengmo@centos5 ~]$ man -f httpdhttpd                (8)  - Apache Hypertext Transfer Protocol Serverhttpd               (rpm) - Apache HTTP Serverhttpd-devel         (rpm) - Development tools for the Apache HTTP server.# Query in the whatis database (with all website man help and cat, doc help information index), the document with the file title starting with: http# For the (8) in the middle, we can use man 8 httpd for calling. For the display (rpm), there is actually an httpd help information, which is an httpd rpm installation package, man rpm httpd cannot be used. You can use rpm-ql httpd to find the installation package[chengmo@centos5 ~]$ man -k httpdCGI::Carp            (3pm)  - CGI routines for writing to the HTTPD (or other) error loghttpd                (8)  - Apache Hypertext Transfer Protocol Serverhttpd               (rpm) - Apache HTTP Serverhttpd-devel         (rpm) - Development tools for the Apache HTTP server.httpd_selinux        (8)  - Security Enhanced Linux Policy for the httpd daemonlighttpd             (1)  - a fast, secure and flexible webserverlighttpd            (rpm) - Lightning fast webserver with light system requirementslighttpd-fastcgi    (rpm) - FastCGI module and spawning helper for lighttpd and PHP configurationncsa_auth            (8)  - NCSA httpd-style password file authentication helper for Squid# In the whatis database, query all httpd help manuals and installation packages. You can use: rpm-ql lighttpd [chengmo@centos5 ~]$ rpm -ql lighttpd | grep gz/usr/share/man/man1/lighttpd.1.gz# In fact, this package is: lighttpd (1)-a fast, secure and flexible webserver help manual[chengmo@centos5 ~]$ man -w/usr/kerberos/man:/usr/local/share/man:/usr/share/man/zh_CN:/usr/share/man:/usr/local/man# Display the man command to find the path of the Manual

 

For the whatis database and the help file for linux in Chinese culture, we will not analyze it here.

You can run the following command first if you are not familiar with the command:

Man-k command1 queries all information similar to the Help file, so that the output can be used at most:

Man-f command1)

Man 5 command1 get help information by directly locating 5

 

Info

Several commands are organized in the form of a topic so that we can read them. Several commands of this topic are connected in the form of node in the topic. Because John is not very familiar with the info command, he will not be involved in it here. When he realizes its true meaning one day, he will come back to complete the introduction.

The main shortcut key settings are as follows:

Buttons Action
Space Flip down
Page Down Flip down
Page Up Page up
Tab Switch between nodes. If there is a node, it is usually displayed *
Enter When the cursor is on the node, press Enter to Enter the node
B Move the cursor to the first node in the info screen
E Move the cursor to the last node in the info screen
N Switch to the next node
P Switch to the previous node
U Move up a Layer
S (/) Search in info page
H Show Help Menu
? Command list
Q Exit

 

 

  

 

 

 

 

 

 

 

 

 

 

If you have not mentioned any important knowledge points, please note in your comments that I will maintain them again based on the suggestions and try my best to achieve perfection! Thank you.

 

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.