Long $ prompt

Erik Christiansen erik at dd.nec.com.au
Tue Jun 20 03:11:01 UTC 2006

On Mon, Jun 19, 2006 at 08:41:23PM +0300, OOzy Pal wrote:
> How can make ubuntu shows only the current directory and its parent
> only in Knosole i.e. if my pwd is
> ~/1/2/3/4/5/6/7/8$
> I'd like ubuntu to only show
> ~/7/8$

It should not be difficult to adapt Dave Vehrs' prompt_workingdir
function, found in a longer script at

The function trims to pwdmaxlen, which you can adjust from the current
1/4 window width, and prefixes "...", which seems neat. Anyway, handed
that for a start, the world is your oyster. ;-)

He also changes colours when $cwd is not writable, and after su, with
gradated privilege indication. (For me, $ and # have long sufficed, but
it might be worth considering.)


More information about the ubuntu-users mailing list