Linux terminal command line prompt art-PS1 advanced words not to mention, first glance at my command line prompt (a little big): the command line in the figure explains: calendar [calendar date/lunar Date and Time] Calendar [number of directories under the current directory + number of items below the current directory] [current absolute Directory] Calendar [user name @ host name-number of terminals] related configuration file global configuration file: /etc/bash. bashrc or/ect/bashrc single-user configuration file: "~" Directory. the bashrc hidden File Code corresponds to the following code (the original PS1 can be changed or directly added to the end of the configuration file ): get_ps1 () {Date = $ (date + % F) Time = $ (date-R | cut-c 18-25 | sed's /,//') lunar = $ (lunar 'date + % Y \ % m \ % d' | grep '^ Lunar \: '| awk' {print $3} '| sed's/^ ..... \(. *\).. $/\ 1/') dn = $ (ls-l | grep ^ d | wc-l); fn = $ (expr $ (ls | wc-l) -$ {dn}) Num = $ (echo $ Lunar | wc-m) ["$ Num" = "5"] & space = ''[" $ Num "=" 4 "] & space ='' PS1 = "\ 342 \ 224 \ 214 [\ [\ e [01; 32m \] $ {Date}/$ {Lunar} $ {space} $ {Time} \ [\ e [00m \] \ n \ 342 \ 224 [\ [\ e [01; 34m \] $ {dn} \ [\ e [00m \] + $ {fn}] [\ [\ e [01; 34m \] \ w \ [\ e [00m \] \ n \ 342 \ 224 \ 224 [$ {debian_chroot: + ($ debian_chroot )} \ [\ e [01; 32m \] \ u @ \ h-\ l \ [\ e [00m \] \ 342 \ 225 \ 260 \ 137 \ 342 \ 225 \ 257] \ $ "} PROMPT_COMMAND = get_ps1 if you think the above command line prompt is too complicated, you can also reduce it... If you want to design a command line prompt that you like and is dazzling enough, you must first understand the following. 1) The lunar date is involved. You can find the lunar software package from the source in Ubuntu 12.04 LTS, but it does not exist in Fedora and CentOS, for this reason, I wrote a shell script for converting the Gregorian calendar to the lunar calendar. For details, refer to my Linux shell to convert the Gregorian calendar to the lunar calendar http://www.bkjia.com/ OS /201307/228131.html. 2) escape characters and colors. I am no longer arrogant about this. google's "Linux Command Line color" will have a lot of answers. 3) PROMPT_COMMAND: This is the key to real-time command line. The content of this variable will be executed before the bash prompt is displayed, so the real-time content used above needs it. 4) What should I do if special characters cannot be displayed? You can convert it to character encoding. You can go to http://0xcc.net/jsescape/to enter the Escape Character in the plain text column. In the \ OOO column, it is the character encoding you want.