This seems like a common question, but I can't find this anywhere on Google nor SO. Please point me to the article if you find one.
How do I insert a new line in bash prompts (when you just press ENTER), similar to that in Windows prompt?
Linux:
$
$
$
Windows:
C:\>
C:\>
C:\>
I need that extra space in between.
The simplest way to insert a new line between echo statements is to insert an echo without arguments, for example: That is, echo without any arguments will print a blank line. Another alternative to use a single echo statement with the -e flag and embedded newline characters :
To change your Bash prompt, you just have to add, remove, or rearrange the special characters in the PS1 variable. But there are many more variables you can use than the default ones. Leave the text editor for now—in nano, press Ctrl+X to exit.
There’s one more powerful trick you should know about: You can add the output of any command to the prompt. Whenever the prompt appears, Bash will run the command and fill in the current information. To do this, just include any command you want to run between two ` characters.
Whenever the prompt appears, Bash will run the command and fill in the current information. To do this, just include any command you want to run between two ` characters. That’s not an apostrophe—that’s the grave accent, which appears above the Tab key on your keyboard.
Change the PS1 Bash prompt variable:
PS1="\n$PS1"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With