Skip to content
xeor edited this page Jun 12, 2011 · 4 revisions

This is the most important part of this project. Its a very informative and nice to look at bash prompt. Its originally from Dave Vehrs (From 2005). Changes since then is listed in the file. It should also be portable between Linux and osx now.

The format of the prompt is like [SYSINFO] USER@HOST [dynamic section] { CURRENT DIRECTORY }[$#]

  • SYSINFO

    • If system_type and/or system_category is set, this field will be visible and contains static info.
    • system_type and system_category can be set in the config file, /etc/sysinfo or ~/.sysinfo
    • If system_type is:
      • 'crit' field will be red
      • 'prod' field will be yellow
      • 'test' field will be green
      • 'ignore' it will not look for /etc/sysinfo or ~/.sysinfo (default)
      • Anything else is ingored.
    • system_category will be the text of this field. Example db, web, ldap and so on.
    • If system_category is sat but not system_type. The field will be default color
    • If system_type is sat but not system_category. The field will be system_type color, but be named crit, prod or test.
    • The usage of this field is just for information to the logged in sysadmin, so he/she knows he/she is working on eg a critical webserver.
  • USER

    • Red == Root(UID 0) Login shell (i.e. sudo bash)
    • Light Red == Root(UID 0) Login shell (i.e. su -l or direct login)
    • Yellow == Root(UID 0) priviledges in non-login shell (i.e. su)
    • Brown == SU to user other than root(UID 0)
    • Green == Normal user
  • @

    • Light Red == http_proxy environmental variable undefined.
    • Green == http_proxy environmental variable configured.
  • HOST:

    • Red == Insecure remote connection (unknown type)
    • Yellow == Insecure remote connection (Telnet)
    • Brown == Insecure remote connection (RSH)
    • Cyan == Secure remote connection (i.e. SSH)
    • Green == Local session
  • [dynamic section] - If the information in any dynamic section is zero worth, it will not be shown

    • [venv:NAME] ==== Name of the virtual envirnoment you are currently using if using python virtual_env
    • [svn:#:#] ==== Display version of current svn directory
      • Will contain * at end if you got local modification
      • If two numbers, 1st is last updated version, 2nd is your version
      • If one number, your version is the last checked out
    • [git:r#] ==== Display version of current git directory
      • Will contain * at end if you got local modification
    • [es:#] ==== Exit code of last command run
    • [scr:#] ==== Number of detached screen sessions
      • Yellow == 1-2
      • Red == 3+
    • [bg:#] ==== Number of backgrounded but still running jobs
      • Yellow == 1-10
      • Red == 11+
    • [stp:#] ==== Number of stopped (backgrounded) jobs
      • Yellow == 1-2
      • Red == 3+
  • CURRENT DIRECTORY: (truncated to 1/3 screen width)

    • Red == Current user does not have write priviledges
    • Green == Current user does have write priviledges
  • Note:

    • The bash prompt will also save your history every time you type a new command, so new shells will get the latest history.
    • A message will be displayed on daychange.
Clone this wiki locally