PDA

View Full Version : Howto: make your terminal a bit nicer


oceanelement
August 10th, 2005, 10:46 PM
Anyone who uses terminals and fell victim to long bash lines such as below know the pain of dealing with:

john@nyork:~/directory1/directory2/directory3/.../directory10022/

Thus as a newbie, I went on a mission to fix this and got help from bimberi on xchat for ubuntu.

Step 1: You will need to edit a file called .bashrc and before you do that make a backup. For example the the file is located at /home/john/.bashrc. There are several locations of this file but just stick with this one.

To backup file in the terminal
cp .bashrc bashrc.original

Afterwards lets dive into the program. Open .bashrc with gedit or whatever editor you prefer to use. Edit the following that is is in red PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
;;
*)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
;;
esac

to ...

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
;;
*)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\$'
;;
esac


And voila! the bash should be nice and short from now on :D

Any comments or corrections is greatly appreciated.

Enjoy

Oceanelement

transactionlogfiller
August 11th, 2005, 05:20 AM
Thanks, I fell foul of the long prompt just last night. This is going to be useful.