The last line of the terminal consists of the shell prompt—which may look like this: John@Mint:~$ —and, after the prompt, a space where you can type the terminal commands that will be interpreted.
You can edit the commands you type, but it's not possible to edit the shell prompt. The shell prompt is static, sometimes decorative, and sometimes informative, as it often contains some contextual information that may be useful if you work on the terminal a lot.
The question is whether the prompt counts as part of the command line or not.
The Contradiction
I assume for most people this isn't important. After all, the only thing we need is a term to refer to the last line of the terminal without having to say "the last line of the terminal where you can type commands," and "command line" is a nice term for that. However, it does lead to some contradictory statements if you take things literally.
A command line is the line on which you type. It contains the shell prompt. The basic format for each line is as follows:
$ Command Argument(s)The shell considers the first word of a command line (up to the first blank space) as the command and all subsequent words as arguments.
https://www.ibm.com/docs/en/aix/7.2?topic=administration-operating-system-shells (accessed 2025-02-20)
For example, in the quote above, we're told that the command line is "the line" on which you type, which implies it's the entire line. This implication is explicated when it explicitly says "it contains the shell prompt." We can even see an example of a command line with the shell prompt in it.
However, the next paragraph we're informed the shell considers "the first word of a command line" as the command, which is contradictory. Sure, a dollar sign ($) isn't a word, it's punctuation, but not all shell prompts are just a single character of text. Often, the shell prompt includes your username and your current working directory, both of which may be composed of words. If these words were part of the command line, it follows that the shell would interpret them as the command, which they clearly don't because that would be nonsense.
I get what it means. You get what it means. Everyone gets what it means. It doesn't matter if it's literally wrong. So long as we can communicate ideas, the language is working just fine. However, does it count as part of the command line or not? This is the question.
Multi-Line Shell Prompts
One way we could try to solve this impasse is by pointing out that while the shell prompt is normally part of the last line, ti doesn't necessarily need to be, or even be a single line at all.
We can customize the shell prompt to have it appear before the last line. As we established already that the command line stands for "that last line in the terminal where you type the commands," if we place the shell prompt on a line before the line you type the commands, the shell prompt is clearly no longer part of the command line at all.
In fact, we can even make the shell prompt span multiple lines, in which case it's not even a "line" anymore, so for it to be part of the "command line" we would have to start calling it "command line(s)."
Unfortunately, this isn't the prefect argument.
Although the command line is typically only a single line, a long enough command won't fit the horizontal space of the terminal, and that will cause a line wrap, thus the command will span multiple lines, meaning we have a multi-line command line. These exist now, apparently.
Even without the automatic line wrap, it's possible to manually insert a line break in the command line in a terminal without causing the command to be executed. This is necessary in the rare case you actually need to send a command some argument that has line breaks, so multi-line command lines are definitely a thing that exists. There is no doubt of that.
Common Sense
Let's say, hypothetically, that we have a terminal with a shell prompt that spans multiple lines, and a command that also spans multiple lines. Something like this:
[John@Mint] [~/Documents]
> echo \
"multi-line bash"
So, looking at this, where does the command line starts and ends?
I'm going to assume most people wouldn't count the first line as being part of the command line since there are no commands in it.
The last line is clearly part of the command line.
The problem is the second line, then.
Does the command line starts at > or does it start at echo?
Personally, I'd say that it starts at echo, but I imagine most people would say it starts at >, because it doesn't really matter either way. Someone needs to run a poll on this. It's very important research.