One day, I learned how to use the help of Linux.

Source: Internet
Author: User
When we are learning and using the Linux system, we feel that the use of commands is a headache, because there are too many system strings and each command also has N multiple parameters, if you are a child prodigy, it is estimated that the problem is similar. I am a mortal, I don't have that skill. I have to hide all of this... information &

When we are learning and using the Linux system, we feel that the use of commands is a headache, because there are too many system strings and each command also has N multiple parameters, if you are a child prodigy, it is estimated that the problem is similar. I am a mortal, and I don't have that skill. I have to hide it all. Is there any convenient way to use these commands? This is what we want to talk about today: man and info. They are like a dictionary. if they don't know what they are, they can flip it out. it's good.
Let's take a look at the usage of this dictionary.

Man command usage
Man is the abbreviation of manual, used to view various reference manuals in the system, but the manual page is divided into several parts


1 User Commands # User Commands
2 System CILS # System call. Functions provided by the kernel
3 C Library Functions # libraries and Functions
4 Devices and Special Files # Devices and Special Files
5 File Formats and Conventions # File format and protocol
6 Games et. Al. # Games
7 Miscellanea # Miscellaneous
8 System Administration tools and Deamons # System administrator tools
You can use man 1 man to view the above eight parts.
From the above description, we can see that the 1 and 5 are very important and most used.
1 is help for some commands, and 5 is help for configuration files. If we do not add a number to the end of man, 1 is used by default.

Learn about man page content
Let's use man to explain
Introduction to NAME
Syntaxes used by SYNOPSIS
DESCRIPTION
Manual sections man MANUAL division (eight parts above)
OPTIONS detailed parameter descriptions for SYNOPSIS
Cat pages command file format
Html pages command file format
SEARCH PATH FOR MANUAL PAGES
ENVIRONMENT variables
BUGS
AUTHOR of AUTHOR
See also for reference
Of course, there will be some other content, such
COMMANDS available for COMMANDS
EXAMPLES
FILES use, reference, or link to some FILES
The help depends on the content you want to search. For example, I don't know how to use the ls command. I will focus on the OPTIONS section. If I don't understand what the command is, I will focus on the DESCRIPTION section.

We can see that the content in the help file is rich. Looking down from one line to the other, is it a waste of time? here are some tips for man.
Use the space key to flip down the page and PgUp PgDn to flip up and down the page. To search for keywords, you can use/keyword (keyword) to search down for keyword, continue to search for n, and use N in reverse. Search for keywords upwards? Keyword ). HOME to the first page, END to the last page. Q: Exit man.
Refer


Man page settings
Different release versions may be different. However, they are usually stored in the/usr/share/man Directory. we can change this directory by modifying the man page search path. Let's take a look at the/etc/man. config file.
[Root @ yufei ~] # Vim/etc/man. config
......
MANPATH/usr/man
MANPATH/usr/share/man
MANPATH/usr/local/man
MANPATH/usr/local/share/man
MANPATH/usr/X11R6/man
......
Here is the directory to be searched by man. If we have installed some software on our own, we can also add the help file for software installation to man's directory, as shown in
# MANPATH/opt/*/man
# MANPATH/usr/lib/*/man
# MANPATH/usr/share/*/man

There is a problem here. when we look at some command help, why will we find the corresponding help file in the directory here? That is the following ing function. (Let's talk about the user's environment variables later)
......
MANPATH_MAP/bin/usr/share/man
MANPATH_MAP/sbin/usr/share/man
MANPATH_MAP/usr/bin/usr/share/man
MANPATH_MAP/usr/sbin/usr/share/man
MANPATH_MAP/usr/local/bin/usr/local/share/man
MANPATH_MAP/usr/local/sbin/usr/local/share/man
MANPATH_MAP/usr/X11R6/bin/usr/X11R6/man
MANPATH_MAP/usr/bin/X11/usr/X11R6/man
MANPATH_MAP/usr/bin/mh/usr/share/man
......

We will not introduce other settings here. For more in-depth research, you can refer to the relevant access documents.

To better use man, let's look at several instances.
1. View help files related to man commands in the system
[Root @ yufei ~] # Man-f man
Man (1)-format and display the on-line manual pages
Man (1 p)-display system documentation
Man (7)-macros to format man pages
Man-pages (7)-conventions for writing Linux man pages
Man. config [man] (5)-configuration data for man
From the above information, we can see that the numbers in the brackets correspond to the following description, I want to see the format and usage of the man command and use man 1 man to view it. (generally, man 1 is omitted and man is used directly. That is, man 1 man = man ). If I want to see the man configuration file, I can use man-5 man. config to view it.

2. search by keywords
[Root @ yufei ~] # Man-k network
......
NetworkManager. conf [NetworkManager] (5)-NetworkManager configuration file
Wget [wget] (1)-The non-interactive network downloader
......
This is rich in content. if you only remember the keywords, the above Command is a very good choice.
If you don't know which command to use, find man. If you don't even know how to write commands, use a TAB! Both of them can be used.

Info command
Basically, info and man are similar in usage, both of which are used to query command usage or file format. However, unlike man page, info page splits file data into one section, and each section is written on its own page, in addition, there is a "HYPERLINK" similar to a webpage in each page to jump to different pages. each independent page is also called a node ). Therefore, you can think of info page as the webpage display data in text mode. However, the description file of the target data you want to query must be written into the info format to use special functions (such as hyperlinks) of info ). The files supporting the info command are stored in the/usr/share/info/directory by default.
The following uses info as an example.
File: the info page information is provided by the info.info File.
Node: indicates that the current page belongs to the Top Node, meaning that info.info contains a lot of information, while Top is only the content of a Node in the info.info file.
Next: The name of the Next node is Getting Started. you can also press "N" to go to the Next node.
Up: return to the node overview screen of the previous layer. you can also press "U" to return to the previous layer.
Prev: Previous node
Tab: you can quickly move the cursor between nodes in the screen above the table.
Because info and man have the same purpose, so I will not explain it too much here. For more information about info, please study it on your own.

-Help and-h
These two parameters are generally followed by the command to display command usage help. The content displayed here is relatively simple.

Other online help content
Generally, commands or software developers generally create their own commands or software instructions as a help file for your reference in order to allow users to quickly use commands or software. However, after all, not all of them need to be made into online help files, and there are a lot of instructions that require additional files. These instruction files are generally stored in the/usr/share/doc Directory. if you are interested, you can check them in this directory. The directory where you want to view the information. Haha, so everyone should study English, because these materials are all written in English.

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.