Customize Shell Prompt
Table for shell prompt
| Sequence | Description | Sequence | Description | |
|---|---|---|---|---|
| \d | The date (+%a\ %b\ %d format) 1) | \v | The version of the shell (short) | |
| \D{format} | The date in the desired format (in strftime format) 2) | \w | The path of the working directory | |
| \t | The time, 24-hour (+%k:%M:%S format) 3) | \W | The name of the working directory | |
| \T | The time, 12-hour (+%l:%M:%S format) 4) | ! | The current command number in the history | |
| \@ | The time, 12-hour, with AM/PM (+%l:%M\ %p format) 5) | # | The command number (from the start of the shell) | |
| \A | The time, 24-hour (+%k:%M format) 6) | $ | If the current user is root, displays a #, else displays a $ | |
| \h | The host name | [ | Start a sequence of non-printing characters | |
| \H | The full host name (with the domain name) | ] | End a sequence of non-printing characters | |
| \j | The number of suspended processes in the current shell ( |
|||
| \l | The name of the shell’s terminal device | \a ,\007 | The bell character | |
| \s | The name of the shell executable | \n | Start a new line | |
| \u | The current user name | \r | Carriage return | |
| \ | A single backslash | \e ,\033 | The Escape character. Used by some Control Sequences (see bellow) |
Prompt Examples
For system wide change
- /etc/profile
- /etc/bashrc
For user based changes
~/.bash_profile ~/.bash_login ~/.profile ~/.bashrc ~/.bash_logout