Possible Duplicate:
Hide current working directory in terminal

When I open a terminal it shows something like dave@daves:~$ or dave@daves:~/Desktop$. I don't want the dave@daves to show up. Can this be modified to show only the time or something simple like a DOS prompt?

  • What you want is what you want, but I find it incredibly useful to have the username@currentserver as part of the prompt. Quite often I'm remoted into a few different systems, and the prompt is an easy way to keep track of which terminal is logged into which system. – djeikyb Jan 28 '11 at 0:51

You could put PS1='\w> ' in your ~/.bashrc.

It will look like this:


when you are in your home directory, and


when you are in /usr/bin.

There are four different time formats you can have:

  • \t - 24-hour HH:MM:SS
  • \T - 12-hour HH:MM:SS
  • \A - 24-hour HH:MM (i.e. no seconds)
  • \@ - 12-hour HH:MM

so for example:

PS1='\A \w> '

would give you something like:

10:14 ~>

See Controlling the Prompt for a list of all the different backslash sequences you can use.

If you can't find one you like, you can also add the output of any command to your prompt, e.g.

PS1='$(date +"%H:%M") $(echo $PWD)> '

would do basically the same as above, but using commands rather than backslash sequences.

Finally, note that the quotes and spaces are important. The easiest way to get PS1='\A \w> ' as your prompt is to run this:

echo "PS1='\A \w> '" >> ~/.bashrc
  • Excellent, Just what I was looking for. Thanks. – deleted Jan 27 '11 at 23:34

I have this as my Linux prompt.

in my .bashrc I have these 2 variables...


but then again,
I am sicker than most.

Not the answer you're looking for? Browse other questions tagged or ask your own question.