Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| labs:custom_prompt [2009/09/24 19:47] – admin | labs:custom_prompt [2022/01/28 16:59] (current) – [Bash Escape Sequences] admin | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| You will need to edit your '' | You will need to edit your '' | ||
| - | You will define a PS1 variable and export it. | + | You will define a '' |
| Line 18: | Line 18: | ||
| \h the hostname up to the first `.' | \h the hostname up to the first `.' | ||
| \H the hostname | \H the hostname | ||
| - | \j | + | \j |
| - | shell | + | \l the basename of the shell' |
| - | \l the basename of the shell' | + | |
| - | name | + | |
| \n | \n | ||
| \r | \r | ||
| Line 34: | Line 32: | ||
| | | ||
| \w the current working directory | \w the current working directory | ||
| - | \W | + | \W |
| - | tory | + | |
| \! the history number of this command | \! the history number of this command | ||
| \# the command number of this command | \# the command number of this command | ||
| - | \$ if the effective UID is 0, a #, otherwise | + | \$ if the effective UID is 0, a #, otherwise a $ |
| - | $ | + | \nnn |
| - | \nnn | + | |
| - | number nnn | + | |
| \\ a backslash | \\ a backslash | ||
| \[ begin a sequence of non-printing characters, | \[ begin a sequence of non-printing characters, | ||
| Line 49: | Line 44: | ||
| ===== Color Codes ===== | ===== Color Codes ===== | ||
| - | |Black | + | |Black |
| - | Blue | + | |Red |
| - | Green | + | |Green | |
| - | Cyan | + | |Brown |
| - | Red 0;31 Light Red 1;31 | + | |Blue |
| - | Purple | + | |Purple |
| - | Brown 0;33 | + | |Cyan | |
| - | Light Gray 0;37 | + | |Light Gray | 0;37 |
| ===== Examples ===== | ===== Examples ===== | ||
| Line 65: | Line 60: | ||
| PS1=' | PS1=' | ||
| - | # With Color: | + | Look at the escape sequences above to help you determine what the above prompt description means. |
| - | PS1=" | + | |
| + | '' | ||
| PS1=" | PS1=" | ||
| + | |||
| + | This one would look like hostname: | ||
| + | |||
| + | **With Color: | ||
| + | |||
| + | PS1=" | ||
| + | |||
| export PS1=" | export PS1=" | ||
