Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I configure my .bash_profile to add a blank line after any command output?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
    
My 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. –  humanfly Feb 6 '12 at 0:06
    
Try putting the newline at the start of your prompt. :) –  Daniel Pittman Feb 6 '12 at 0:11

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.

share|improve this answer
    
In more recent version of OS X this file was renamed to: ~/.profile –  Marcus Böhm Aug 2 at 8:34
    
@MarcusBöhm: Completely different file, see e.g. man bash, section INVOCATION. However, if you've never changes anything, the files I mention may not exist. –  Daniel Beck Aug 2 at 9:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.