修改linux bash的提示符

5491阅读 0评论2012-04-27 playmud
分类:LINUX


点击(此处)折叠或打开

  1. PS1 The value of this parameter is expanded (see PROMPTING below) and used as the primary
  2. prompt string. The default value is ``\s-\v\$ ''.
  3. PS2 The value of this parameter is expanded as with PS1 and used as the secondary prompt
  4. string. The default is ``> ''.
  5. PS3 The value of this parameter is used as the prompt for the select command (see SHELL
  6. GRAMMAR above).
  7. PS4 The value of this parameter is expanded as with PS1 and the value is printed before
  8. each command bash displays during an execution trace. The first character of PS4 is
  9. replicated multiple times, as necessary, to indicate multiple levels of indirection.
  10. The default is ``+ ''.

  11. PROMPTING
  12. When executing interactively, bash displays the primary prompt PS1 when it is ready to read a
  13. command, and the secondary prompt PS2 when it needs more input to complete a command. Bash
  14. allows these prompt strings to be customized by inserting a number of backslash-escaped spe-
  15. cial characters that are decoded as follows:
  16. \a an ASCII bell character (07)
  17. \d the date in "Weekday Month Date" format (e.g., "Tue May 26")
  18. \D{format}
  19. the format is passed to strftime(3) and the result is inserted into the prompt
  20. string; an empty format results in a locale-specific time representation. The
  21. braces are required
  22. \e an ASCII escape character (033)
  23. \h the hostname up to the first `.'
  24. \H the hostname
  25. \j the number of jobs currently managed by the shell
  26. \l the basename of the shell's terminal device name
  27. \n newline
  28. \r carriage return
  29. \s the name of the shell, the basename of $0 (the portion following the final
  30. slash)
  31. \t the current time in 24-hour HH:MM:SS format
  32. \T the current time in 12-hour HH:MM:SS format
  33. \@ the current time in 12-hour am/pm format
  34. \A the current time in 24-hour HH:MM format
  35. \u the username of the current user
  36. \v the version of bash (e.g., 2.00)
  37. \V the release of bash, version + patch level (e.g., 2.00.0)
  38. \w the current working directory, with $HOME abbreviated with a tilde
  39. \W the basename of the current working directory, with $HOME abbreviated with a
  40. tilde
  41. \! the history number of this command
  42. \# the command number of this command
  43. \$ if the effective UID is 0, a #, otherwise a $
  44. \nnn the character corresponding to the octal number nnn
  45. \\ a backslash
  46. \[ begin a sequence of non-printing characters, which could be used to embed a ter-
  47. minal control sequence into the prompt
  48. \] end a sequence of non-printing characters
  49. The command number and the history number are usually different: the history number of a com-
  50. mand is its position in the history list, which may include commands restored from the history
  51. file (see HISTORY below), while the command number is the position in the sequence of commands
  52. executed during the current shell session. After the string is decoded, it is expanded via
  53. parameter expansion, command substitution, arithmetic expansion, and quote removal, subject to
  54. the value of the promptvars shell option (see the description of the shopt command under SHELL
  55. BUILTIN COMMANDS below).

上一篇:gdb进化的很高端了
下一篇:要来的一个linux命令提示符的配置,一切为了得瑟