I see the tutorial, when create a user:

useradd -g liao1 lamp

You see they place the -g liao1 before the lamp, and I tested the:

useradd lamp -g liao1

I put the param after the name, I can create the user too, but I am not sure if there is distinction.

  • It depends on how the program is written to parse command line options/arguments... – ivanivan Jun 19 '17 at 2:28

As ivanivan noted, the interpretation of the line parameters is done by the program (useradd) in your case. Many programs don't care about the order of the parameters, but some do.

Eg. convert (from the imagemagick package) converts images and specifies:

convert [input-option] input-file [output-option] output-file

So, the input-option(s) have to be specified before the input file, and similar for the output-option(s).

There are much more complicated examples, such as compilers, which need options to be in a specific order in order to work correctly.

In all cases, it's very advisable to consult the man pages of the command, or the --help (or -h or -? or whatever) of the program you want to run. Things can go wrong...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.