PS1 in Linux environment variables

Source: Internet
Author: User

  
 
  1. Linux环境变量中PS1是很重要的环境变量:
  2. PS(Prompt Sign): 是指命令提示符,例如在Fedora 12的终端下:[[email protected] ~]$ ,在设定PS1环境变量时,我们需要用到预设的一些特殊符号来设定PS1,下面是鸟哥书上关于BASH的特殊变量。
  3. o \d :代表日期,格式为 Weekday Month Date,例如 "Mon Aug 1"
  4. o \H :完整的主机名称。举例来说,鸟哥的练习机 linux.dmtsai.tw ,那么这个主机名称就是 linux.dmtsai.tw www.2cto.com
  5. o \h :仅取主机名称的第一个名字。以上述来讲,就是 linux 而已, .dmtsai.tw 被省略。
  6. o \t :显示时间,为 24 小时格式,如: HH:MM:SS
  7. o \T :显示时间,12 小时的时间格式!
  8. o \A :显示时间,24 小时格式, HH:MM
  9. o \u :目前使用者的账号名称;
  10. o \v :BASH 的版本信息;
  11. o \w :完整的工作目录名称。家目录会以 ~ 取代;
  12. o \W :利用 basename 取得工作目录名称,所以仅会列出最后一个目录名。
  13. o \# :下达的第几个指令。
  14. o \$ :提示字符,如果是 root 时,提示字符为 # ,否则就是 $ 。



From for notes (Wiz)

PS1 in Linux environment variables

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.