Mac OS Lion Terminal: Add blank line after command output?
Solution 1
You want to adjust the shell prompt; the default shell is bash, and it will happily inject a newline into the prompt by embedding \n
in the appropriate variables. (PS1 by default.)
More details at http://www.ibm.com/developerworks/linux/library/l-tip-prompt/ or in the manual page - though that is a much more pleasant reference.
Solution 2
Add the following line at the end of ~/.bash_profile
or ~/.bashrc
, whichever exists:
PS1="\n$PS1"
This will add a newline before a prompt is printed, which is after control is returned to the shell.
Unless your command prompt contains shell commands or variables (which would get executed/interpreted at the time of variable assignment), this will work. Otherwise, just prepend the \n
to your original prompt definition.
Related videos on Youtube
humanfly
Updated on September 18, 2022Comments
-
humanfly almost 2 years
How can I configure my
.bash_profile
to add a blank line after any command output? -
humanfly over 12 yearsMy shell is bash and below is what I currently have: export PS1="\u:\w - " With above if I add "\n" at the end then the new line gets added immediately after the second line hyphen "-" and not after command output. I am looking for something that would add new line after command execution.
-
Daniel Pittman over 12 yearsTry putting the newline at the start of your prompt. :)
-
Marcus Böhm almost 10 yearsIn more recent version of OS X this file was renamed to:
~/.profile
-
HikeMike almost 10 years@MarcusBöhm: Completely different file, see e.g.
man bash
, sectionINVOCATION
. However, if you've never changes anything, the files I mention may not exist.