Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

marked as duplicate by Stefano Palazzo, RolandiXor, dv3500ea, Oli, Alvin Row Jan 28 '11 at 17:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
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

2 Answers 2

up vote 8 down vote accepted

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

It will look like this:

~> 

when you are in your home directory, and

/usr/bin> 

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
share|improve this answer
    
Excellent, Just what I was looking for. Thanks. –  tufkab Jan 27 '11 at 23:34

I have this as my Linux prompt.
C:\home\jj>

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

DOS='C:${PWD//\//\\\}>'
PS1="\[\033[00m\]\[\033[01;31m\]$MKF\n\[\033[00m\]\[\033[01;39m\]$DOS\[\033[00m\]"

but then again,
I am sicker than most.

share|improve this answer

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