When learning linux commands, including some commands under windows, some friends can’t distinguish the concepts of “options” and “parameters”, and can’t understand the format of options and parameters under linux commands. This paper briefly introduces the difference between the two.
After logging in to Linux, we can enter the command after the “ා” or “$”, sometimes the command will be followed by “options” or “arguments”. That is to say, the command format in Linux is:
command [options] [arguments] //Brackets represent optional, that is, some commands do not need options or parameters, but some commands need multiple options or parameters at runtime.
Option is the switch to adjust the execution behavior of the command, that is, different options determine the different display results of the command.
Options are divided into long options and short options.
Short options: such as – H, – L, – s, etc.
L short options are guided by ‘-‘, and when there are multiple short options, the options are separated by spaces.
L some short options of commands can be combined, such as – L – h can be combined as – LH
L short options for some commands can be left blank – this is often called BSD style options, such as PS aux
L some short options need to have their own parameters, such as – L 512M
Long options: such as — help, — list, etc.
L long selections are complete words
L long options usually cannot be combined
L if you need parameters, the parameters of long options usually need ‘=’, such as — size = 1g
Parameter refers to the action object of the command.
For example, if the LS command displays the current directory without parameters, you can also add parameters. For example, if LS / dev is used, the output result is the / dev directory.
The above briefly describes the differences between options and parameters, but we need to rely on experience to accumulate or view the help of Linux for specific options and parameters of which command in Linux.