7

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?

deleted
  • 2,479
  • 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 00:51

2 Answers2

9

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
Mikel
  • 6,558
0

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.

Habitual
  • 254