Change your Unix Command Prompt Now

The Unix command-line shell is a very powerful, highly customizable environment. So it's supposed to help you be more productive, right? But not with a drab command prompt that never changes:

[jharvard@researchgrid] $

This prompt is set by the bash environment variable PS1, usually specified in one of your login scripts (~/.bashrc to be more precise. See this document on what these are and why they matter). There's a weird syntax here, but with Google, Stack Overflow, and O'Reilly's Learning the Bash Shell, there's plenty of explanation. So let's present one customization to make this always visible line a productive tool that shines!

Show Me Where I Am!

You can see that with the default prompt, we're presented with the current user and the hostname. But it would be infinitely more helpful to have bash tell me what the current directory is. Execute the following commands at your Unix prompt:

export PS1='[\u@\h \W]\$ '

echo "export PS1='[\u@\h \W]\$ ' " >> ~/.bashrc

After this your login prompt will appear as

[jharvard@researchgrid currentdir] $ 

where currentdir is the folder name that you are currently working in.

There are other customizations out there. The sky and your imagination are the limit!