Command line option style
1. Original UNIX Style
A, the command-line option begins with a hyphen '-' followed by a single character representing the option, followed by a value such as: Mysql-hlocalhost
b, the option does not take value, can be combined together, such as: Sed-n-R can be written SED-NR
C, preference for lowercase letters, uppercase letters have other meanings, very concise
2. GNU Style
A, command-line options start with two hyphens '--' followed by the option name, followed by a space or an equal sign after the option.
b, easy to remember, write trouble.
3, most of the program is mixed with two styles, both styles are supported, the former is the latter abbreviated way, as follows:
MySQL--host localhost or MySQL--host=localhost, abbreviated to Mysql-hlocalhost, note the abbreviated way try not to write mysql-h localhost, or mysql-h=loca Lhost, because this can be difficult to parse, spaces may be considered the next option, and the equals sign may be considered part of the value. Like what:
Mysql-hlocalhost-uroot-p 123456, think 123456 is a database, also need to enter a password.
mysql-hlocalhost-uroot-p=123456, that the password is "= 123456", of course, the password is wrong.
4, through the man xxx or xxx--help We can see the use of the command, will list options and options abbreviated way, such as MySQL--help
-H,--host=name Connect to host. The preceding is abbreviated, followed by a description.
5, the general abbreviation is to take the first character of the full name, there is a problem of conflict. For example:--host and--help, the solution is: one provides an abbreviated way, the other one does not provide. It is also possible to provide another character that represents an abbreviation, which is a character in uppercase or similar meaning. For example: MySQL lowercase p is the abbreviation for password, and uppercase P is the abbreviation for port.
6, for help, there will generally be three ways,--help,-H 、-?
Over time, there are some unwritten conventions for shorthand, as follows:
-A
All (LS-A)
Append
-B
Set Buffer/block size (du)
-D
Debug
Directory (ls-d)
Delete
diffrent
-D
Define (GCC-DMAC)
-E
Execute (SED-E ' command '-e ' Command1 ')
Exclude
Expression
-F
File (grep-f file)
Force (RM-RF)
-H
Header (PS)
-I.
Initialize
Ineractive (Rm-i)
-I.
Include (Gcc-ipath)
-K
Keep (passwd, bZIP, Fetchmail)
Kill
-L
List (ls-l)
Load (gcc-llib)
-M
Message (git commit-m)
-N
Number (Head-n 1)
-O
Output (wget)
-P
Port (SSH)
Protocol (Fetchmail)
-Q
Quite (make)
-R (R)
Recurse (CP)
Reverse (sort)
-S
Slient (Fetmail)
Subject (mail, mutt)
Size
-T
Tag (vi)
-U
User (PS, fetchmail)
-V
Verbose (TAR, CP, CAT)
Version (patch)
-V
Version (GCC, hostname)
-W
Width (OD)
Warning (Flex)
-X
Enable Debug-D
-Y
Yes (yum update-y)
-Z
Enable compression (bZIP, TAR)
Linux command-line options