command line terminology: what are these parts of a command called?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
21
down vote

favorite
6












At the command line I often use "simple" commands like



mv foo/bar baz/bar


but I don't know what to call all the parts of this:



┌1┐ ┌──2───┐
git checkout master
│ └──────3──────┘
└───────4─────────┘


I (think I) know that 1 is a command and 2's an argument, and I'd probably call 3 an argument list (is that correct?).



However, I don't know what to call 4.



How are more complex "commands" labelled?



find transcripts/?.? -name '*.txt' | parallel -- sh -c 'echo $1 $2' /


I'd appreciate an answer that breaks down what to call 1,2,3,4 and what to call each part of e.g. this "command" above.



It would be great to learn also about other things that are unique/surprising that I haven't included here.







share|improve this question


















  • 1




    Have you looked at the man pages for git and find, in particular the synopsis section?
    – fpmurphy1
    Jan 14 at 1:55






  • 4




    Have you looked at the man pages for git and find So the question seems nothing to do with git or find rather general terminology for linux.
    – Att Righ
    Jan 14 at 2:02










  • According to the bash man page in A | B, A | B is a pipeline, A and B are commands (it's unfortunate that this has the same name as just the first world in a command). I might call the first argument an executable but I can't find a source that agrees with me.
    – Att Righ
    Jan 14 at 2:24






  • 4




    In the context of git checkout ..., checkout is a subcommand, and in the context of sh -c ..., -c is an option.
    – wjandrea
    Jan 14 at 4:15











  • @JoL thanks for pointing that out. You guessed right, I've edited that. It's because I re-wrote that section some 4 times as I tried to do it properly
    – theonlygusti
    Jan 14 at 10:15














up vote
21
down vote

favorite
6












At the command line I often use "simple" commands like



mv foo/bar baz/bar


but I don't know what to call all the parts of this:



┌1┐ ┌──2───┐
git checkout master
│ └──────3──────┘
└───────4─────────┘


I (think I) know that 1 is a command and 2's an argument, and I'd probably call 3 an argument list (is that correct?).



However, I don't know what to call 4.



How are more complex "commands" labelled?



find transcripts/?.? -name '*.txt' | parallel -- sh -c 'echo $1 $2' /


I'd appreciate an answer that breaks down what to call 1,2,3,4 and what to call each part of e.g. this "command" above.



It would be great to learn also about other things that are unique/surprising that I haven't included here.







share|improve this question


















  • 1




    Have you looked at the man pages for git and find, in particular the synopsis section?
    – fpmurphy1
    Jan 14 at 1:55






  • 4




    Have you looked at the man pages for git and find So the question seems nothing to do with git or find rather general terminology for linux.
    – Att Righ
    Jan 14 at 2:02










  • According to the bash man page in A | B, A | B is a pipeline, A and B are commands (it's unfortunate that this has the same name as just the first world in a command). I might call the first argument an executable but I can't find a source that agrees with me.
    – Att Righ
    Jan 14 at 2:24






  • 4




    In the context of git checkout ..., checkout is a subcommand, and in the context of sh -c ..., -c is an option.
    – wjandrea
    Jan 14 at 4:15











  • @JoL thanks for pointing that out. You guessed right, I've edited that. It's because I re-wrote that section some 4 times as I tried to do it properly
    – theonlygusti
    Jan 14 at 10:15












up vote
21
down vote

favorite
6









up vote
21
down vote

favorite
6






6





At the command line I often use "simple" commands like



mv foo/bar baz/bar


but I don't know what to call all the parts of this:



┌1┐ ┌──2───┐
git checkout master
│ └──────3──────┘
└───────4─────────┘


I (think I) know that 1 is a command and 2's an argument, and I'd probably call 3 an argument list (is that correct?).



However, I don't know what to call 4.



How are more complex "commands" labelled?



find transcripts/?.? -name '*.txt' | parallel -- sh -c 'echo $1 $2' /


I'd appreciate an answer that breaks down what to call 1,2,3,4 and what to call each part of e.g. this "command" above.



It would be great to learn also about other things that are unique/surprising that I haven't included here.







share|improve this question














At the command line I often use "simple" commands like



mv foo/bar baz/bar


but I don't know what to call all the parts of this:



┌1┐ ┌──2───┐
git checkout master
│ └──────3──────┘
└───────4─────────┘


I (think I) know that 1 is a command and 2's an argument, and I'd probably call 3 an argument list (is that correct?).



However, I don't know what to call 4.



How are more complex "commands" labelled?



find transcripts/?.? -name '*.txt' | parallel -- sh -c 'echo $1 $2' /


I'd appreciate an answer that breaks down what to call 1,2,3,4 and what to call each part of e.g. this "command" above.



It would be great to learn also about other things that are unique/surprising that I haven't included here.









share|improve this question













share|improve this question




share|improve this question








edited Jan 14 at 10:14

























asked Jan 14 at 1:22









theonlygusti

21217




21217







  • 1




    Have you looked at the man pages for git and find, in particular the synopsis section?
    – fpmurphy1
    Jan 14 at 1:55






  • 4




    Have you looked at the man pages for git and find So the question seems nothing to do with git or find rather general terminology for linux.
    – Att Righ
    Jan 14 at 2:02










  • According to the bash man page in A | B, A | B is a pipeline, A and B are commands (it's unfortunate that this has the same name as just the first world in a command). I might call the first argument an executable but I can't find a source that agrees with me.
    – Att Righ
    Jan 14 at 2:24






  • 4




    In the context of git checkout ..., checkout is a subcommand, and in the context of sh -c ..., -c is an option.
    – wjandrea
    Jan 14 at 4:15











  • @JoL thanks for pointing that out. You guessed right, I've edited that. It's because I re-wrote that section some 4 times as I tried to do it properly
    – theonlygusti
    Jan 14 at 10:15












  • 1




    Have you looked at the man pages for git and find, in particular the synopsis section?
    – fpmurphy1
    Jan 14 at 1:55






  • 4




    Have you looked at the man pages for git and find So the question seems nothing to do with git or find rather general terminology for linux.
    – Att Righ
    Jan 14 at 2:02










  • According to the bash man page in A | B, A | B is a pipeline, A and B are commands (it's unfortunate that this has the same name as just the first world in a command). I might call the first argument an executable but I can't find a source that agrees with me.
    – Att Righ
    Jan 14 at 2:24






  • 4




    In the context of git checkout ..., checkout is a subcommand, and in the context of sh -c ..., -c is an option.
    – wjandrea
    Jan 14 at 4:15











  • @JoL thanks for pointing that out. You guessed right, I've edited that. It's because I re-wrote that section some 4 times as I tried to do it properly
    – theonlygusti
    Jan 14 at 10:15







1




1




Have you looked at the man pages for git and find, in particular the synopsis section?
– fpmurphy1
Jan 14 at 1:55




Have you looked at the man pages for git and find, in particular the synopsis section?
– fpmurphy1
Jan 14 at 1:55




4




4




Have you looked at the man pages for git and find So the question seems nothing to do with git or find rather general terminology for linux.
– Att Righ
Jan 14 at 2:02




Have you looked at the man pages for git and find So the question seems nothing to do with git or find rather general terminology for linux.
– Att Righ
Jan 14 at 2:02












According to the bash man page in A | B, A | B is a pipeline, A and B are commands (it's unfortunate that this has the same name as just the first world in a command). I might call the first argument an executable but I can't find a source that agrees with me.
– Att Righ
Jan 14 at 2:24




According to the bash man page in A | B, A | B is a pipeline, A and B are commands (it's unfortunate that this has the same name as just the first world in a command). I might call the first argument an executable but I can't find a source that agrees with me.
– Att Righ
Jan 14 at 2:24




4




4




In the context of git checkout ..., checkout is a subcommand, and in the context of sh -c ..., -c is an option.
– wjandrea
Jan 14 at 4:15





In the context of git checkout ..., checkout is a subcommand, and in the context of sh -c ..., -c is an option.
– wjandrea
Jan 14 at 4:15













@JoL thanks for pointing that out. You guessed right, I've edited that. It's because I re-wrote that section some 4 times as I tried to do it properly
– theonlygusti
Jan 14 at 10:15




@JoL thanks for pointing that out. You guessed right, I've edited that. It's because I re-wrote that section some 4 times as I tried to do it properly
– theonlygusti
Jan 14 at 10:15










2 Answers
2






active

oldest

votes

















up vote
34
down vote



accepted










The common names for each part is as follows:



┌1┐ ┌──2───┐
git checkout master
│ └──────3──────┘
└───────4─────────┘


  1. Command name (first word or token of command line that is not a redirection or variable assignment and after aliases have been expanded).



  2. Token, word, or argument to the command. From man bash:




    word: A sequence of characters considered as a single unit by the shell. Also known as a token.




  3. Generally: Arguments


  4. Command line.


The concatenation of two simple commands with a | is a pipe sequence or pipeline:



┌─1┐ ┌──────2──────┐ ┌─2─┐ ┌──2──┐ ┌──1───┐ ┌2┐┌2┐┌2┐┌────2─────┐ ┌2┐ ┌2┐
find transcripts/?.? -name '*.txt' | parallel -- sh -c 'echo $1 $2' /
│ └────────────3──────────────┘ └────────────3──────────────┘
└───────────────────────────────────4─────────────────────────────────────┘


Mind that there are redirection and variable assignments also:



┌──5──┐ ┌1┐ ┌─2─┐ ┌─2─┐ ┌───6──┐ ┌1┐ ┌─5─┐
<infile tee file1 file2 | LC_ALL=C cat >file
└─────────7───────────┘ └───────7────────┘
└─────────────────────4────────────────────┘


Where (beside the numbers from above):



  1. redirection.

  2. Variable assignment.

  3. Simple command.

This is not an exaustive list of all the element a command line could have. Such a list is too complex for this short answer.






share|improve this answer


















  • 2




    In POSIX terminology, what you call pipe is a pipe sequence or pipeline (though a pipeline can have an optional leading ! to negate its status). pipe would rather refer to the IPC mechanism used by most shells to implement pipelines (pipelines don't have to use pipes, ksh93 uses socketpairs instead on some systems for instance). Some shells have more keywords like time, noglob that can be used instead or in addition to ! here.
    – Stéphane Chazelas
    Jan 14 at 9:53







  • 1




    IMHO, these things are called arguments - nothing else so I think the word token in this context means "atomic unit of bash's grammar". Here the term token only exists in the context of shell command line, not in the context of the program executes. It would be a bit weird to say "these are the programs tokens" but perhaps less strange to say "the second token in the command line is $test". A distinction comes up in cat $file, here I would say $file is a token, but the value of file is the argument.
    – Att Righ
    Jan 14 at 20:44







  • 1




    @PeterCordes You are correct, <<<"…" is a redirection, not an argument. Though it is still a token of the line. Sorry for the confusion.
    – Isaac
    Jan 14 at 21:52






  • 1




    @TOOGAM Those are exactly opposite to the standard definitions. The things the caller provides are arguments; cf. “formal parameter”, or this SO question.
    – Michael Homer
    Jan 15 at 5:30






  • 1




    @TOOGAM "What I see are parameters". Hmm I think you are right. According the POSIX spec: "The shell executes a function (see Function Definition Command), built-in (see Special Built-In Utilities), executable file, or script, giving the names of the arguments as positional parameters numbered 1 to n, and the name of the command (or in the case of a function within a script, the name of the script) as the positional parameter numbered 0 (see Command Search and Execution)." and I had been wrong all these years... Although in my defense it is called argv
    – Att Righ
    Jan 15 at 13:03


















up vote
15
down vote













@isaac's answer above seems good.



I want to extend this with some sources.



I guess the POSIX standard might in some sense be considered canonical.
Other sources might be man bash and man proc.



┌1┐ ┌──2───┐
git checkout master
│ └──────3──────┘
└───────4─────────┘


POSIX suggests that:



  1. Is the command name (rather than the command, though even this document uses command in places)


  2. Argument


  3. Arguments


  4. Command (though man proc uses the command line)

It also has terminology for many more complicated commands.



I think command is pretty ambiguous so perhaps the term command name and command line are good for clarity.j






share|improve this answer






















  • What's proc? I've never heard of that.
    – theonlygusti
    Jan 14 at 10:18










  • @theonlygusti man7.org/linux/man-pages/man5/proc.5.html
    – Moira
    Jan 14 at 10:42






  • 5




    +1 I like this answer best. (In this specific context, 2 is a subcommand, but generally yes, an argument).
    – kubanczyk
    Jan 14 at 14:02










  • @theonlygusti proc is a special purpose filesystem (collection of files) that provide information about the kernel's internal state. I believe it stands for processes (see also sysfs which provides information about things others than processes). The reason it is relevant is written by kernel developers, so may well reflect the language that they use which might be a little more formal.
    – Att Righ
    Jan 14 at 20:28











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f416945%2fcommand-line-terminology-what-are-these-parts-of-a-command-called%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
34
down vote



accepted










The common names for each part is as follows:



┌1┐ ┌──2───┐
git checkout master
│ └──────3──────┘
└───────4─────────┘


  1. Command name (first word or token of command line that is not a redirection or variable assignment and after aliases have been expanded).



  2. Token, word, or argument to the command. From man bash:




    word: A sequence of characters considered as a single unit by the shell. Also known as a token.




  3. Generally: Arguments


  4. Command line.


The concatenation of two simple commands with a | is a pipe sequence or pipeline:



┌─1┐ ┌──────2──────┐ ┌─2─┐ ┌──2──┐ ┌──1───┐ ┌2┐┌2┐┌2┐┌────2─────┐ ┌2┐ ┌2┐
find transcripts/?.? -name '*.txt' | parallel -- sh -c 'echo $1 $2' /
│ └────────────3──────────────┘ └────────────3──────────────┘
└───────────────────────────────────4─────────────────────────────────────┘


Mind that there are redirection and variable assignments also:



┌──5──┐ ┌1┐ ┌─2─┐ ┌─2─┐ ┌───6──┐ ┌1┐ ┌─5─┐
<infile tee file1 file2 | LC_ALL=C cat >file
└─────────7───────────┘ └───────7────────┘
└─────────────────────4────────────────────┘


Where (beside the numbers from above):



  1. redirection.

  2. Variable assignment.

  3. Simple command.

This is not an exaustive list of all the element a command line could have. Such a list is too complex for this short answer.






share|improve this answer


















  • 2




    In POSIX terminology, what you call pipe is a pipe sequence or pipeline (though a pipeline can have an optional leading ! to negate its status). pipe would rather refer to the IPC mechanism used by most shells to implement pipelines (pipelines don't have to use pipes, ksh93 uses socketpairs instead on some systems for instance). Some shells have more keywords like time, noglob that can be used instead or in addition to ! here.
    – Stéphane Chazelas
    Jan 14 at 9:53







  • 1




    IMHO, these things are called arguments - nothing else so I think the word token in this context means "atomic unit of bash's grammar". Here the term token only exists in the context of shell command line, not in the context of the program executes. It would be a bit weird to say "these are the programs tokens" but perhaps less strange to say "the second token in the command line is $test". A distinction comes up in cat $file, here I would say $file is a token, but the value of file is the argument.
    – Att Righ
    Jan 14 at 20:44







  • 1




    @PeterCordes You are correct, <<<"…" is a redirection, not an argument. Though it is still a token of the line. Sorry for the confusion.
    – Isaac
    Jan 14 at 21:52






  • 1




    @TOOGAM Those are exactly opposite to the standard definitions. The things the caller provides are arguments; cf. “formal parameter”, or this SO question.
    – Michael Homer
    Jan 15 at 5:30






  • 1




    @TOOGAM "What I see are parameters". Hmm I think you are right. According the POSIX spec: "The shell executes a function (see Function Definition Command), built-in (see Special Built-In Utilities), executable file, or script, giving the names of the arguments as positional parameters numbered 1 to n, and the name of the command (or in the case of a function within a script, the name of the script) as the positional parameter numbered 0 (see Command Search and Execution)." and I had been wrong all these years... Although in my defense it is called argv
    – Att Righ
    Jan 15 at 13:03















up vote
34
down vote



accepted










The common names for each part is as follows:



┌1┐ ┌──2───┐
git checkout master
│ └──────3──────┘
└───────4─────────┘


  1. Command name (first word or token of command line that is not a redirection or variable assignment and after aliases have been expanded).



  2. Token, word, or argument to the command. From man bash:




    word: A sequence of characters considered as a single unit by the shell. Also known as a token.




  3. Generally: Arguments


  4. Command line.


The concatenation of two simple commands with a | is a pipe sequence or pipeline:



┌─1┐ ┌──────2──────┐ ┌─2─┐ ┌──2──┐ ┌──1───┐ ┌2┐┌2┐┌2┐┌────2─────┐ ┌2┐ ┌2┐
find transcripts/?.? -name '*.txt' | parallel -- sh -c 'echo $1 $2' /
│ └────────────3──────────────┘ └────────────3──────────────┘
└───────────────────────────────────4─────────────────────────────────────┘


Mind that there are redirection and variable assignments also:



┌──5──┐ ┌1┐ ┌─2─┐ ┌─2─┐ ┌───6──┐ ┌1┐ ┌─5─┐
<infile tee file1 file2 | LC_ALL=C cat >file
└─────────7───────────┘ └───────7────────┘
└─────────────────────4────────────────────┘


Where (beside the numbers from above):



  1. redirection.

  2. Variable assignment.

  3. Simple command.

This is not an exaustive list of all the element a command line could have. Such a list is too complex for this short answer.






share|improve this answer


















  • 2




    In POSIX terminology, what you call pipe is a pipe sequence or pipeline (though a pipeline can have an optional leading ! to negate its status). pipe would rather refer to the IPC mechanism used by most shells to implement pipelines (pipelines don't have to use pipes, ksh93 uses socketpairs instead on some systems for instance). Some shells have more keywords like time, noglob that can be used instead or in addition to ! here.
    – Stéphane Chazelas
    Jan 14 at 9:53







  • 1




    IMHO, these things are called arguments - nothing else so I think the word token in this context means "atomic unit of bash's grammar". Here the term token only exists in the context of shell command line, not in the context of the program executes. It would be a bit weird to say "these are the programs tokens" but perhaps less strange to say "the second token in the command line is $test". A distinction comes up in cat $file, here I would say $file is a token, but the value of file is the argument.
    – Att Righ
    Jan 14 at 20:44







  • 1




    @PeterCordes You are correct, <<<"…" is a redirection, not an argument. Though it is still a token of the line. Sorry for the confusion.
    – Isaac
    Jan 14 at 21:52






  • 1




    @TOOGAM Those are exactly opposite to the standard definitions. The things the caller provides are arguments; cf. “formal parameter”, or this SO question.
    – Michael Homer
    Jan 15 at 5:30






  • 1




    @TOOGAM "What I see are parameters". Hmm I think you are right. According the POSIX spec: "The shell executes a function (see Function Definition Command), built-in (see Special Built-In Utilities), executable file, or script, giving the names of the arguments as positional parameters numbered 1 to n, and the name of the command (or in the case of a function within a script, the name of the script) as the positional parameter numbered 0 (see Command Search and Execution)." and I had been wrong all these years... Although in my defense it is called argv
    – Att Righ
    Jan 15 at 13:03













up vote
34
down vote



accepted







up vote
34
down vote



accepted






The common names for each part is as follows:



┌1┐ ┌──2───┐
git checkout master
│ └──────3──────┘
└───────4─────────┘


  1. Command name (first word or token of command line that is not a redirection or variable assignment and after aliases have been expanded).



  2. Token, word, or argument to the command. From man bash:




    word: A sequence of characters considered as a single unit by the shell. Also known as a token.




  3. Generally: Arguments


  4. Command line.


The concatenation of two simple commands with a | is a pipe sequence or pipeline:



┌─1┐ ┌──────2──────┐ ┌─2─┐ ┌──2──┐ ┌──1───┐ ┌2┐┌2┐┌2┐┌────2─────┐ ┌2┐ ┌2┐
find transcripts/?.? -name '*.txt' | parallel -- sh -c 'echo $1 $2' /
│ └────────────3──────────────┘ └────────────3──────────────┘
└───────────────────────────────────4─────────────────────────────────────┘


Mind that there are redirection and variable assignments also:



┌──5──┐ ┌1┐ ┌─2─┐ ┌─2─┐ ┌───6──┐ ┌1┐ ┌─5─┐
<infile tee file1 file2 | LC_ALL=C cat >file
└─────────7───────────┘ └───────7────────┘
└─────────────────────4────────────────────┘


Where (beside the numbers from above):



  1. redirection.

  2. Variable assignment.

  3. Simple command.

This is not an exaustive list of all the element a command line could have. Such a list is too complex for this short answer.






share|improve this answer














The common names for each part is as follows:



┌1┐ ┌──2───┐
git checkout master
│ └──────3──────┘
└───────4─────────┘


  1. Command name (first word or token of command line that is not a redirection or variable assignment and after aliases have been expanded).



  2. Token, word, or argument to the command. From man bash:




    word: A sequence of characters considered as a single unit by the shell. Also known as a token.




  3. Generally: Arguments


  4. Command line.


The concatenation of two simple commands with a | is a pipe sequence or pipeline:



┌─1┐ ┌──────2──────┐ ┌─2─┐ ┌──2──┐ ┌──1───┐ ┌2┐┌2┐┌2┐┌────2─────┐ ┌2┐ ┌2┐
find transcripts/?.? -name '*.txt' | parallel -- sh -c 'echo $1 $2' /
│ └────────────3──────────────┘ └────────────3──────────────┘
└───────────────────────────────────4─────────────────────────────────────┘


Mind that there are redirection and variable assignments also:



┌──5──┐ ┌1┐ ┌─2─┐ ┌─2─┐ ┌───6──┐ ┌1┐ ┌─5─┐
<infile tee file1 file2 | LC_ALL=C cat >file
└─────────7───────────┘ └───────7────────┘
└─────────────────────4────────────────────┘


Where (beside the numbers from above):



  1. redirection.

  2. Variable assignment.

  3. Simple command.

This is not an exaustive list of all the element a command line could have. Such a list is too complex for this short answer.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 14 at 16:47

























answered Jan 14 at 2:12









Isaac

6,7711834




6,7711834







  • 2




    In POSIX terminology, what you call pipe is a pipe sequence or pipeline (though a pipeline can have an optional leading ! to negate its status). pipe would rather refer to the IPC mechanism used by most shells to implement pipelines (pipelines don't have to use pipes, ksh93 uses socketpairs instead on some systems for instance). Some shells have more keywords like time, noglob that can be used instead or in addition to ! here.
    – Stéphane Chazelas
    Jan 14 at 9:53







  • 1




    IMHO, these things are called arguments - nothing else so I think the word token in this context means "atomic unit of bash's grammar". Here the term token only exists in the context of shell command line, not in the context of the program executes. It would be a bit weird to say "these are the programs tokens" but perhaps less strange to say "the second token in the command line is $test". A distinction comes up in cat $file, here I would say $file is a token, but the value of file is the argument.
    – Att Righ
    Jan 14 at 20:44







  • 1




    @PeterCordes You are correct, <<<"…" is a redirection, not an argument. Though it is still a token of the line. Sorry for the confusion.
    – Isaac
    Jan 14 at 21:52






  • 1




    @TOOGAM Those are exactly opposite to the standard definitions. The things the caller provides are arguments; cf. “formal parameter”, or this SO question.
    – Michael Homer
    Jan 15 at 5:30






  • 1




    @TOOGAM "What I see are parameters". Hmm I think you are right. According the POSIX spec: "The shell executes a function (see Function Definition Command), built-in (see Special Built-In Utilities), executable file, or script, giving the names of the arguments as positional parameters numbered 1 to n, and the name of the command (or in the case of a function within a script, the name of the script) as the positional parameter numbered 0 (see Command Search and Execution)." and I had been wrong all these years... Although in my defense it is called argv
    – Att Righ
    Jan 15 at 13:03













  • 2




    In POSIX terminology, what you call pipe is a pipe sequence or pipeline (though a pipeline can have an optional leading ! to negate its status). pipe would rather refer to the IPC mechanism used by most shells to implement pipelines (pipelines don't have to use pipes, ksh93 uses socketpairs instead on some systems for instance). Some shells have more keywords like time, noglob that can be used instead or in addition to ! here.
    – Stéphane Chazelas
    Jan 14 at 9:53







  • 1




    IMHO, these things are called arguments - nothing else so I think the word token in this context means "atomic unit of bash's grammar". Here the term token only exists in the context of shell command line, not in the context of the program executes. It would be a bit weird to say "these are the programs tokens" but perhaps less strange to say "the second token in the command line is $test". A distinction comes up in cat $file, here I would say $file is a token, but the value of file is the argument.
    – Att Righ
    Jan 14 at 20:44







  • 1




    @PeterCordes You are correct, <<<"…" is a redirection, not an argument. Though it is still a token of the line. Sorry for the confusion.
    – Isaac
    Jan 14 at 21:52






  • 1




    @TOOGAM Those are exactly opposite to the standard definitions. The things the caller provides are arguments; cf. “formal parameter”, or this SO question.
    – Michael Homer
    Jan 15 at 5:30






  • 1




    @TOOGAM "What I see are parameters". Hmm I think you are right. According the POSIX spec: "The shell executes a function (see Function Definition Command), built-in (see Special Built-In Utilities), executable file, or script, giving the names of the arguments as positional parameters numbered 1 to n, and the name of the command (or in the case of a function within a script, the name of the script) as the positional parameter numbered 0 (see Command Search and Execution)." and I had been wrong all these years... Although in my defense it is called argv
    – Att Righ
    Jan 15 at 13:03








2




2




In POSIX terminology, what you call pipe is a pipe sequence or pipeline (though a pipeline can have an optional leading ! to negate its status). pipe would rather refer to the IPC mechanism used by most shells to implement pipelines (pipelines don't have to use pipes, ksh93 uses socketpairs instead on some systems for instance). Some shells have more keywords like time, noglob that can be used instead or in addition to ! here.
– Stéphane Chazelas
Jan 14 at 9:53





In POSIX terminology, what you call pipe is a pipe sequence or pipeline (though a pipeline can have an optional leading ! to negate its status). pipe would rather refer to the IPC mechanism used by most shells to implement pipelines (pipelines don't have to use pipes, ksh93 uses socketpairs instead on some systems for instance). Some shells have more keywords like time, noglob that can be used instead or in addition to ! here.
– Stéphane Chazelas
Jan 14 at 9:53





1




1




IMHO, these things are called arguments - nothing else so I think the word token in this context means "atomic unit of bash's grammar". Here the term token only exists in the context of shell command line, not in the context of the program executes. It would be a bit weird to say "these are the programs tokens" but perhaps less strange to say "the second token in the command line is $test". A distinction comes up in cat $file, here I would say $file is a token, but the value of file is the argument.
– Att Righ
Jan 14 at 20:44





IMHO, these things are called arguments - nothing else so I think the word token in this context means "atomic unit of bash's grammar". Here the term token only exists in the context of shell command line, not in the context of the program executes. It would be a bit weird to say "these are the programs tokens" but perhaps less strange to say "the second token in the command line is $test". A distinction comes up in cat $file, here I would say $file is a token, but the value of file is the argument.
– Att Righ
Jan 14 at 20:44





1




1




@PeterCordes You are correct, <<<"…" is a redirection, not an argument. Though it is still a token of the line. Sorry for the confusion.
– Isaac
Jan 14 at 21:52




@PeterCordes You are correct, <<<"…" is a redirection, not an argument. Though it is still a token of the line. Sorry for the confusion.
– Isaac
Jan 14 at 21:52




1




1




@TOOGAM Those are exactly opposite to the standard definitions. The things the caller provides are arguments; cf. “formal parameter”, or this SO question.
– Michael Homer
Jan 15 at 5:30




@TOOGAM Those are exactly opposite to the standard definitions. The things the caller provides are arguments; cf. “formal parameter”, or this SO question.
– Michael Homer
Jan 15 at 5:30




1




1




@TOOGAM "What I see are parameters". Hmm I think you are right. According the POSIX spec: "The shell executes a function (see Function Definition Command), built-in (see Special Built-In Utilities), executable file, or script, giving the names of the arguments as positional parameters numbered 1 to n, and the name of the command (or in the case of a function within a script, the name of the script) as the positional parameter numbered 0 (see Command Search and Execution)." and I had been wrong all these years... Although in my defense it is called argv
– Att Righ
Jan 15 at 13:03





@TOOGAM "What I see are parameters". Hmm I think you are right. According the POSIX spec: "The shell executes a function (see Function Definition Command), built-in (see Special Built-In Utilities), executable file, or script, giving the names of the arguments as positional parameters numbered 1 to n, and the name of the command (or in the case of a function within a script, the name of the script) as the positional parameter numbered 0 (see Command Search and Execution)." and I had been wrong all these years... Although in my defense it is called argv
– Att Righ
Jan 15 at 13:03













up vote
15
down vote













@isaac's answer above seems good.



I want to extend this with some sources.



I guess the POSIX standard might in some sense be considered canonical.
Other sources might be man bash and man proc.



┌1┐ ┌──2───┐
git checkout master
│ └──────3──────┘
└───────4─────────┘


POSIX suggests that:



  1. Is the command name (rather than the command, though even this document uses command in places)


  2. Argument


  3. Arguments


  4. Command (though man proc uses the command line)

It also has terminology for many more complicated commands.



I think command is pretty ambiguous so perhaps the term command name and command line are good for clarity.j






share|improve this answer






















  • What's proc? I've never heard of that.
    – theonlygusti
    Jan 14 at 10:18










  • @theonlygusti man7.org/linux/man-pages/man5/proc.5.html
    – Moira
    Jan 14 at 10:42






  • 5




    +1 I like this answer best. (In this specific context, 2 is a subcommand, but generally yes, an argument).
    – kubanczyk
    Jan 14 at 14:02










  • @theonlygusti proc is a special purpose filesystem (collection of files) that provide information about the kernel's internal state. I believe it stands for processes (see also sysfs which provides information about things others than processes). The reason it is relevant is written by kernel developers, so may well reflect the language that they use which might be a little more formal.
    – Att Righ
    Jan 14 at 20:28















up vote
15
down vote













@isaac's answer above seems good.



I want to extend this with some sources.



I guess the POSIX standard might in some sense be considered canonical.
Other sources might be man bash and man proc.



┌1┐ ┌──2───┐
git checkout master
│ └──────3──────┘
└───────4─────────┘


POSIX suggests that:



  1. Is the command name (rather than the command, though even this document uses command in places)


  2. Argument


  3. Arguments


  4. Command (though man proc uses the command line)

It also has terminology for many more complicated commands.



I think command is pretty ambiguous so perhaps the term command name and command line are good for clarity.j






share|improve this answer






















  • What's proc? I've never heard of that.
    – theonlygusti
    Jan 14 at 10:18










  • @theonlygusti man7.org/linux/man-pages/man5/proc.5.html
    – Moira
    Jan 14 at 10:42






  • 5




    +1 I like this answer best. (In this specific context, 2 is a subcommand, but generally yes, an argument).
    – kubanczyk
    Jan 14 at 14:02










  • @theonlygusti proc is a special purpose filesystem (collection of files) that provide information about the kernel's internal state. I believe it stands for processes (see also sysfs which provides information about things others than processes). The reason it is relevant is written by kernel developers, so may well reflect the language that they use which might be a little more formal.
    – Att Righ
    Jan 14 at 20:28













up vote
15
down vote










up vote
15
down vote









@isaac's answer above seems good.



I want to extend this with some sources.



I guess the POSIX standard might in some sense be considered canonical.
Other sources might be man bash and man proc.



┌1┐ ┌──2───┐
git checkout master
│ └──────3──────┘
└───────4─────────┘


POSIX suggests that:



  1. Is the command name (rather than the command, though even this document uses command in places)


  2. Argument


  3. Arguments


  4. Command (though man proc uses the command line)

It also has terminology for many more complicated commands.



I think command is pretty ambiguous so perhaps the term command name and command line are good for clarity.j






share|improve this answer














@isaac's answer above seems good.



I want to extend this with some sources.



I guess the POSIX standard might in some sense be considered canonical.
Other sources might be man bash and man proc.



┌1┐ ┌──2───┐
git checkout master
│ └──────3──────┘
└───────4─────────┘


POSIX suggests that:



  1. Is the command name (rather than the command, though even this document uses command in places)


  2. Argument


  3. Arguments


  4. Command (though man proc uses the command line)

It also has terminology for many more complicated commands.



I think command is pretty ambiguous so perhaps the term command name and command line are good for clarity.j







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 14 at 2:42

























answered Jan 14 at 2:34









Att Righ

574313




574313











  • What's proc? I've never heard of that.
    – theonlygusti
    Jan 14 at 10:18










  • @theonlygusti man7.org/linux/man-pages/man5/proc.5.html
    – Moira
    Jan 14 at 10:42






  • 5




    +1 I like this answer best. (In this specific context, 2 is a subcommand, but generally yes, an argument).
    – kubanczyk
    Jan 14 at 14:02










  • @theonlygusti proc is a special purpose filesystem (collection of files) that provide information about the kernel's internal state. I believe it stands for processes (see also sysfs which provides information about things others than processes). The reason it is relevant is written by kernel developers, so may well reflect the language that they use which might be a little more formal.
    – Att Righ
    Jan 14 at 20:28

















  • What's proc? I've never heard of that.
    – theonlygusti
    Jan 14 at 10:18










  • @theonlygusti man7.org/linux/man-pages/man5/proc.5.html
    – Moira
    Jan 14 at 10:42






  • 5




    +1 I like this answer best. (In this specific context, 2 is a subcommand, but generally yes, an argument).
    – kubanczyk
    Jan 14 at 14:02










  • @theonlygusti proc is a special purpose filesystem (collection of files) that provide information about the kernel's internal state. I believe it stands for processes (see also sysfs which provides information about things others than processes). The reason it is relevant is written by kernel developers, so may well reflect the language that they use which might be a little more formal.
    – Att Righ
    Jan 14 at 20:28
















What's proc? I've never heard of that.
– theonlygusti
Jan 14 at 10:18




What's proc? I've never heard of that.
– theonlygusti
Jan 14 at 10:18












@theonlygusti man7.org/linux/man-pages/man5/proc.5.html
– Moira
Jan 14 at 10:42




@theonlygusti man7.org/linux/man-pages/man5/proc.5.html
– Moira
Jan 14 at 10:42




5




5




+1 I like this answer best. (In this specific context, 2 is a subcommand, but generally yes, an argument).
– kubanczyk
Jan 14 at 14:02




+1 I like this answer best. (In this specific context, 2 is a subcommand, but generally yes, an argument).
– kubanczyk
Jan 14 at 14:02












@theonlygusti proc is a special purpose filesystem (collection of files) that provide information about the kernel's internal state. I believe it stands for processes (see also sysfs which provides information about things others than processes). The reason it is relevant is written by kernel developers, so may well reflect the language that they use which might be a little more formal.
– Att Righ
Jan 14 at 20:28





@theonlygusti proc is a special purpose filesystem (collection of files) that provide information about the kernel's internal state. I believe it stands for processes (see also sysfs which provides information about things others than processes). The reason it is relevant is written by kernel developers, so may well reflect the language that they use which might be a little more formal.
– Att Righ
Jan 14 at 20:28













 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f416945%2fcommand-line-terminology-what-are-these-parts-of-a-command-called%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?