Linux MAN Syntax structure description

Source: Internet
Author: User

I. The content structure of the man Manual (the format of the manual page):
Title Meaning:
Name and purpose of the name Command (summary)
Synopsis command Syntax (abstract)
Description Full Description
Environment variables used by the environment command
Author author
File list of files that are important to the command
See also where to view related information
Diagnostics possible errors and warnings bugs errors, drawbacks, warnings
When we look at the command usage, we are most concerned with the second and third items.
The formal description of the Linux command syntax in the second man manual
Options: Command options are available in two forms: the Long option (-) and the short option (-):
Long options: Use--boot, followed by complete words, such as--help
Short options: With-boot, followed by a single character, such as-a
Multiple short options can be combined, for example:-h-l-A = =-hla
However, long options can not be combined, such as--help can not be followed by another word.

Options can also have their own parameters, which can be called arguments, (note that between options and options, between options and parameters, there must be spaces between parameters and Parameters!) Also, the symbols used for the options and parameters of the command have the corresponding meanings:
1.[] The items in square brackets are optional;
2.<> items that are not in square brackets or in curly braces are mandatory (there are also <>, but I have not seen them);
3. Black bold words must be typed exactly as they are, which may be command names, flags, and literal characters;
4. Italics must be replaced with an appropriate value (the system that does not display italics is usually replaced with an underscore), as in the case of variables, it is necessary to add the appropriate values according to the circumstances;
5. Follow the ellipsis (...). ) parameters can be repeated multiple times;
6. If a separate option and a parameter are combined, then the option and parameter must be used simultaneously;
7. Two or more items separated by the | (vertical bar) character, indicating that an item can be selected from this list;
8.{A|B} indicates that one must be selected between A and B.

A few simple examples:
The Find command is a search file command under Linux, and the synopsis of the Man Manual is in the format
[Plain] View plaincopy
Find [-h] [-l] [-p] [-D debugopts] [-olevel] [path ...] [Expression]
All of these options are enclosed in ' [] ', stating that all options are optional (and, of course, there is no way to do it);
Path is optional, the default value is the current directory, and the ' ... ' modifier indicates that multiple directories can be added;
-D debugopts indicates that the-D option should be followed by a corresponding parameter;
[A|b] Description A and B can choose one or the other can not choose;
{A|b} indicates that one must be selected between A and B.

Three: command instance analysis
mkdir command, man mkdir in
NAME
Mkdir-make Directories
Indicates that the mkdir command is used to create a directory
Synopsis
mkdir [OPTION] ... DIRECTORY ...
Represents the optional option after mkdir, but must have a target directory to create, which can be followed by multiple
DESCRIPTION
Create the DIRECTORY (ies), if they does not already exist.
Mandatory arguments to long options is Mandatory for short options too.
-M,--mode=mode
Set file mode (as in chmod), not A=rwx-umask
-P,--parents
No error if existing, make parent directories as needed
-V,--verbose
Print a message for each created directory
-Z,--context=ctx
Set the SELinux security context of each created directory to CTX
--help Display this Help and exit
--version
Output version information and exit
The-p and-V options are not special, they do not follow the parameters, the specific role of Baidu
-M,--mode=mode and-Z,--CONTEXT=CTX, the application format should be
Mkdir-m 721./a_dir
mkdir--mode=721./a_dir
It seems like I remember where I've seen it, but I'm actually testing it on my own computer without a difference (I'm using Fedora 19 32-bit system).
mkdir-m=721./a_dir
Mkdri--mode 721./a_dir
The effect is the same. And the long option--mode=721 can still be followed with other options, such as-P, with the former director of the option can not be in conflict with the other options, but after--version does not follow the other option, otherwise it will be an error (left as a reservation).
In another case, such as man find,
-maxdepth levels
Descend at most levels (a non-negative integers) levels of directories below the command line arguments.
-maxdepth 0
means only apply the tests and actions to the command line arguments.
Represents the maximum number of directories to look for, usage is find some options-maxdepth 3 other options.
[] <> meanings appearing in command help when viewing the command help, symbols such as [],<>,|] appear, meaning the following:
[] #表示是可选的;
<> #表示是可变化的;
X|y|z #表示只能选择一个;
-ABC #表示三个参数 (or any two) mixed use

Note: The content from the network of people, read after the self-description is very good, is to grant people to fish. Therefore, if there is infringement, please contact me to delete, thank you!

Linux MAN syntax structure description

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.