Much ado about scripting, Linux & Eclipse: card subject to change


How to make your shell prompt prettier

It's been a long-standing kvetch on my part that when navigating deep directories in a Konsole window (or really, any xterm), when the paths get too long the line wraps on top of itself. So, today, as part of Think Fridays, I decided to solve this problem.

Step one: put the script lspathseg in your /usr/bin/ or somewhere else where your $PATH can find it.

Step two: use it in your /etc/bashrc like this:

export PS1="\$(lspathseg 2) \$ ";

Additionally, if you want to play with colour in your prompt, see my /etc/bashrc for how to do that.


Tim said...

Hello. I did a small writeup on configuring the shell prompt to show useful information for Oracle Database servers. It will show things such as the current directory, current user, current server name, and the current ORACLE_SID.

Check out the link above, its written and tested for Linux AS3/4 servers, although would be easy to modify for other distros/flavors.