Alright, when I run certain commands the wrong way, (misspelled, etc.) The terminal outputs this:
> instead of
computername:workingfolder username$, and when I type enter it goes like this:
> > >
That would be if I pressed enter 3 times.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
> is the default continuation prompt.That is what you will see if what you entered before had unbalanced quote marks.
As an example, type a single quote on the command line followed by a few
$ ' > > >
The continuation prompts will occur until you either
(a) complete the command with a closing quote mark
(b) type Ctrl+D to finish input, at which point the shell will respond with an error message about the unbalanced quotes,
(c) type Ctrl+C which will abort the command that you were entering.
Sometime, you may want to enter a string which contains embedded new lines. You can do that as follows:
$ paragraph='first line > second line > third line > end'
Now, when we display that shell variable, you can see that the prompts have disappeared but the newlines are retained:
$ echo "$paragraph" first line second line third line end
That will happen if you have an unclosed quote in your command. That's something like:
$ echo "test here > > ...
You can exit that mode by closing the quote (write a
', or whatever your open quote is). It could also be a brace-delimited block, a partially-complete
while-do loop, or certain other constructs. You can also press Ctrl-C to cancel this command (then press Up to revise it).
> is your
PS2 ("secondary prompt") value. You can change that to something else to remind you what's happened:
.bashrc will make it print
Unclosed > at the start of each line instead.
The answer lies in this cryptic mention in the Bash Reference Manual:
5.1 Bourne Shell Variables
PS1: The primary prompt string. The default value is ‘
\s-\v\$’. See Printing a Prompt, for the complete list of escape sequences that are expanded before
PS2: The secondary prompt string. The default value is ‘
… followed by:
6.3.3 Interactive Shell Behavior
- Bash expands and displays
PS1before reading the first line of a command, and expands and displays
PS2before reading the second and subsequent lines of a multi-line command.
> prompt appears if you press Enter and Bash determines that the command is incomplete. That could be because:
\, which is treated as a line continuation.
whileloop, or a
If you are seeing the secondary prompt due to an unintentional typing error, hit ControlC to return to the primary prompt.