Bash Prompt too long?

May 5th, 2009 Category: Linux

People often using Putty, xterm or any other Linux test based console will probably now this annoying issue:

  • Changing into a deeper directory structure will create an incredible long bash prompt

For me it was quite annoying to have the prompt sometimes wider than the terminal window. In Debian standard configuration this is the case. So I decided to shorten the prompt.

I kept my prompt very simple, the only thing you have to do is to add the following lines to your ~/.bashrc

export PS1="[\u@\h \W]\\$ "
export PS2="> "

Make sure to add it at the end of your .bashrc file in your home directory. Otherwise it may be overwritten by other prompt definitions in your .bashrc.

Before

harry@h1096660:/usr/local/include/ffmpeg$

After

[harry@h1096660 ffmpeg]$

Better :)

Further links and examples

Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Webnews
  • MisterWong
  • Y!GG
  • Facebook
  • Furl
  • Google Bookmarks
  • Live-MSN
  • Readster
  • YahooMyWeb

Related posts:

  1. PuTTY SSH Login Without Password Prompt
This entry was posted on Tuesday, May 5th, 2009 and is filed under Linux. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply