Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I would like to configure the terminal so that it would leave a line after running a command. Just to make stuff cleaner. There is no such setting in "profile preferences".

I'm running 12.10.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

To alter how bash works you need to edit the hidden file ~/.bashrc

gedit ~/.bashrc

First find the section that look like this:

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\$
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

and change it slightly to look like this (or cut and paste this in replacing the existing section).

###Changed prompt to print a \n 'new line' before user@machine###
if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\n\[\033[01;32m\]\u@\h\[\033[00m\]:\$
else
    PS1='${debian_chroot:+($debian_chroot)}\n\u@\h:\w\$ '

The difference is subtle - just added an escaped newline '\n' before the user@machine prompt. Save the file and exit the terminal window. Changes will take effect next time you open a terminal window or log in to a console.

The reason you have to change both of the lines is that the first one is for the colour prompt, while the second one is for the default monochrome prompt. Actually, before you add in the new line, try the colour prompt first. It does help to delineate the prompt/command/result each time. You might like it. All you have to do is find the slightly earlier line that looks like

#force_color_prompt=yes

and uncomment it by removing the hash:

force_color_prompt=yes
share|improve this answer
    
The "force_color_prompt" is brilliant, exactly what I needed! –  mart0903 Nov 25 '12 at 13:06
add comment

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.