How can I change the Terminal prompt to something simple? [duplicate]
Solution 1:
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