2

I just Joined Linux and I trying to explore commands with the available resources (mainly man pages)

It's easy to understand what are the option args(content in usage and options) in a command manpage, but I've trouble understanding what are the position_args.

take as example vgcreate

How could I know what is the position args, by reading man page?

2 Answers 2

4

Positions args are required to be given in a specific order on the command line.

for your specific example: vgcreate VG_new PV

VG_new must come first, followed by PV. Most the time positional args come at the end of a command.

Most other args, that are mostly (if not always) prefixed by a - or -- can come in any order

vgcreate --clustered y --maxlogicalvolumes  2 newvol /dev/sda1

is the same as

vgcreate --maxlogicalvolumes  2 --clustered y newvol /dev/sda1

while this would at best would result in and error, or could possibly have some undefined or undesirable outcomes:

vgcreate --clustered y --maxlogicalvolumes  2  /dev/sda1 newvol
1
  • In general, the order of command line options is not always arbitrary. Quite often, a later option may override an earlier option. For example, rm -f -i file will behave differently from rm -i -f file. Filename operands on the command line can very seldom occur in any order, especially if the command specific source and target operands.
    – Kusalananda
    Commented Mar 30, 2019 at 8:30
4

Unfortunately, you cannot. The LVM2 doco fails to explain these.

To know what it is, you, an end user of the tools, have instead to go digging around in the program source. A person by the name of David Teigland introduced a new system for the LVM2 toolset in August 2016, which makes all of its manual pages now look like this. The synopsis section is as you saw, and the real synopsis is actually in a "USAGE" section further down.

Commentary in the source code, not exposed to end users as doco, explains that the command line for all of the tools is considered to comprise option arguments (the ones beginning with minuses) and positional arguments (whose meaning is according to their position in the argument vector when all of the option arguments have been removed), and that these are both further subdivided into required and optional.

LVM2 manual pages are not the best. Additionally symptomatic of this is that the official WWW site hyperlinks to nonexistent WWW pages for the manual.

1
  • Hi @JdeBP, I upvoted your answer but accepted Fitz as he expends more time explaining the Position args, and consequently left me no doubts about what it is. However, your contribution was also important to me better understand man pages
    – Nelssen
    Commented Mar 30, 2019 at 8:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .