This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
bash:tip_customize_the_shell_prompt [2011/06/15 17:04] flozz [Example of prompts] |
bash:tip_customize_the_shell_prompt [2011/06/22 11:48] flozz [Special sequences] |
||
---|---|---|---|
Line 20: | Line 20: | ||
===== Special sequences ===== | ===== Special sequences ===== | ||
- | ^ Sequence ^ description ^ Example/Preview ^ | + | ^ Sequence ^ description ^ Example/Preview ^ |
- | | \d | Date (''+%a %b %d'' format) ((''date'' command format)) | ''Mon Jun 13'' | | + | | \d | The date (''+%a\ %b\ %d'' format) ((''date'' command format)) | ''Mon Jun 13'' | |
- | | \t | Time, 24-hour (''+%k:%M:%S'' format) ((''date'' command format)) | ''22:42:01'' | | + | | \D{//format//} | The date in the desired //format// (in ''strftime'' format) ((Not supported by Prompt Helper)) | | |
- | | \T | Time, 12-hour (''+%l:%M:%S'' format) ((''date'' command format)) | ''10:42:01'' | | + | | \t | The time, 24-hour (''+%k:%M:%S'' format) ((''date'' command format)) | ''22:42:01'' | |
- | | \@ | Time, 12-hour, with AM/PM (''+%l:%M %p'' format) ((''date'' command format)) | ''10:42 PM'' or ''10:42'' | | + | | \T | The time, 12-hour (''+%l:%M:%S'' format) ((''date'' command format)) | ''10:42:01'' | |
- | | \h | The host name | ''hostname'' | | + | | \@ | The time, 12-hour, with AM/PM (''+%l:%M\ %p'' format) ((''date'' command format)) | ''10:42 PM'' or ''10:42'' | |
- | | \H | The full host name (with the domain name) | ''hostname.domain'' | | + | | \A | The time, 24-hour (''+%k:%M'' format) ((''date'' command format)) | ''22:42'' | |
- | | \j | The number of suspended processes in the current shell (<Ctrl>+Z) | ''0'' | | + | | \h | The host name | ''hostname'' | |
- | | \l | The name of the shell's terminal device | ''tty1'' or ''1'' | | + | | \H | The full host name (with the domain name) | ''hostname.domain'' | |
- | | \s | The name of the shell executable | ''bash'' | | + | | \j | The number of suspended processes in the current shell (<Ctrl>+Z) | ''0'' | |
- | | \u | The current user name | ''username'' | | + | | \l | The name of the shell's terminal device | ''tty1'' or ''1'' | |
- | | \v | The version of the shell (short) | ''4.1'' | | + | | \s | The name of the shell executable | ''bash'' | |
- | | \V | The version of the shell (with the patch level) | ''4.1.5'' | | + | | \u | The current user name | ''username'' | |
- | | \w | The path of the working directory | ''~/Documents'' or ''/usr/bin'' | | + | | \v | The version of the shell (short) | ''4.1'' | |
- | | \W | The name of the working directory | ''Documents'' or ''bin'' | | + | | \V | The version of the shell (with the patch level) | ''4.1.5'' | |
- | | \! | The current command number in the history | ''538'' | | + | | \w | The path of the working directory | ''~/Documents'' or ''/usr/bin'' | |
- | | \# | The command number (from the start of the shell) | ''42'' | | + | | \W | The name of the working directory | ''Documents'' or ''bin'' | |
- | | \$ | If the current user is root, displays a ''#'', else displays a ''$'' | ''$'' or ''#'' | | + | | \! | The current command number in the history | ''538'' | |
- | | \[ | Start a sequence of non-printing characters | | | + | | \# | The command number (from the start of the shell) | ''42'' | |
- | | \] | End a sequence of non-printing characters | | | + | | \$ | If the current user is root, displays a ''#'', else displays a ''$'' | ''$'' or ''#'' | |
- | | \a \\ \007 | The ASCII bell character | | | + | | \[ | Start a sequence of non-printing characters | | |
- | | \n | Start a new line | | | + | | \] | End a sequence of non-printing characters | | |
- | | \r | Carriage return | | | + | | \a \\ \007 | The ASCII bell character | | |
- | | ''\''''\'' | A single backslash | ''\'' | | + | | \n | Start a new line | | |
- | | \e \\ \033 | The ASCII ''Escape'' character. Used by some [[bash:tip_customize_the_shell_prompt#control_sequences_e_033_x1b|Control Sequences]] (see bellow) | | | + | | \r | Carriage return | | |
+ | | ''\''''\'' | A single backslash | ''\'' | | ||
+ | | \e \\ \033 | The ASCII ''Escape'' character. Used by some [[bash:tip_customize_the_shell_prompt#control_sequences_e_033_x1b|Control Sequences]] (see bellow) | | | ||
Line 93: | Line 95: | ||
===== Links ===== | ===== Links ===== | ||
- | FIXME | + | * [[bash:tip_colors_and_formatting|Bash tips: Colors and formatting]] |
+ | * [[http://www.gnu.org/software/bash/manual/bashref.html#Printing-a-Prompt|Bash manual: Printing a prompt]] | ||
+ | * [[http://www.funtoo.org/wiki/Prompt_Magic|Funtoo: Prompt magic]] | ||