
#Linux remove ansi escape sequences using vi manual
See the man page bash(1) § PROMPTING or the Bash reference manual for a complete list of escape sequences.Īside from the escape characters recognized by Bash, most terminals recognize special escape sequences that affect the terminal itself rather than printing characters.

So a PS1 of '\A \u $ ' would be printed like 17:35 username $. For example, \u is expanded into the current username and \A is expanded to the current time. When printing the prompt string, Bash looks for certain backslash-escaped characters and will expand them into special strings. While one can simply set their prompt to a plain string, there are a variety of techniques for making the prompt more dynamic and useful. The first character is repeated to indicate deeper levels.Īll of the prompts are customized by setting the corresponding variable to the desired string (usually in ~/.bashrc), for example It is displayed when debugging bash scripts to indicate levels of indirection.

Usually you would customize it in the script where the select is used rather than in your. Unlike the other prompts, it does not expand Bash escape sequences. It is the prompt displayed for Bash's select built-in which displays interactive menus.

PS2 is the secondary prompt displayed when a command needs more input (e.g.PS1 is the primary prompt which is displayed before each command, thus it is the one most people customize.PS0 is displayed after each command, before any output.Bash has several prompts which can be customized to increase productivity, aesthetic appeal, and nerd cred.īash has four prompt strings that can be customized:
