| Introduction When we use the terminal or terminal, there may be such a display demand, such as to display the current path, display users, and so on, these are through the configuration.
First look at your cue display, open terminal, enter
A message similar to the following is displayed
\h:\w \u\$
This information is used to define how the prompt is displayed, and the details are listed below.
cd~
This will open the TextEdit, according to your request, you can enter the inside
Export ps1="\u \w$"
Save exit. (Note the English quotation marks)
If you do not have a. bash_profile file, create it, terminal input
CD ~ touch. Bash_profile
Finally, to take effect immediately, you can
SOURCE ~/.bash_profile
PS: If you are using ZSH, you can add the source ~/.bash_profile to the end of the ~/.ZSHRC.
The configuration is as follows:
\a ASCII Bell character (you can also type \007)
\d date in "Wed Sep 06" format
\e ASCII Escape character (you can also type \033)
\h the first part of the hostname (such as "Mybox")
Full name of the \h host (e.g. "mybox.mydomain.com")
\j the number of processes suspended in this shell by pressing ^Z
\l The terminal name of this shell (e.g. "TTYP4")
\ n line break
\ r return character
\s the name of the shell (such as "bash")
\ t 24-hour time (e.g. "23:01:01")
\ t 12-hour time (e.g. "11:01:01")
\@ 12-hour time with AM/PM
\u User Name
\v bash version (e.g. 2.04)
\v Bash version (including patch level)?/td>
\w current working directory (e.g. "/home/drobbins")
\w "base name (basename)" For the current working directory (such as "Drobbins")
\! Position of the current command in the history buffer
\# command number (as long as you type, it will accumulate at each prompt)
\$ If you are not superuser (root), insert a "$"; if you are a superuser, display a "#"
\xxx Insert an ASCII character represented by a three-digit xxx (with 0 instead of unused digits, such as "\007")
\ \ counter Slash
\[This sequence should appear before the character sequence that does not move the cursor (such as the color escape sequence). It enables bash to correctly calculate the wrapping.
\] This sequence should appear after the nonprinting character sequence.
Terminal path display problem under Mac