Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| labs:custom_prompt [2009/09/24 18:02] – created admin | labs:custom_prompt [2022/01/28 16:59] (current) – [Bash Escape Sequences] admin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Customizing Your Terminal' | ====== Customizing Your Terminal' | ||
| + | |||
| + | When executing | ||
| 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 '' |
| + | |||
| + | |||
| + | ===== Bash Escape Sequences ===== | ||
| + | |||
| + | The allowed escape sequences allowed in the Bash prompt are decoded as follows: | ||
| + | |||
| + | \a an ASCII bell character (07) | ||
| + | \d the date in " | ||
| + | | ||
| + | \e an ASCII escape character (033) | ||
| + | \h the hostname up to the first `.' | ||
| + | \H the hostname | ||
| + | \j | ||
| + | \l the basename of the shell' | ||
| + | \n | ||
| + | \r | ||
| + | \s | ||
| + | (the portion following the final slash) | ||
| + | \t the current time in 24-hour HH:MM:SS format | ||
| + | \T the current time in 12-hour HH:MM:SS format | ||
| + | \@ the current time in 12-hour am/pm format | ||
| + | \u the username of the current user | ||
| + | \v the version of bash (e.g., 2.00) | ||
| + | \V the release of bash, version | ||
| + | | ||
| + | \w the current working directory | ||
| + | \W | ||
| + | \! the history number of this command | ||
| + | \# the command number of this command | ||
| + | \$ if the effective UID is 0, a #, otherwise a $ | ||
| + | \nnn | ||
| + | \\ a backslash | ||
| + | \[ begin a sequence of non-printing characters, | ||
| + | which could be used to embed a terminal con | ||
| + | trol sequence into the prompt | ||
| + | \] end a sequence of non-printing characters | ||
| + | ===== Color Codes ===== | ||
| + | |||
| + | |Black | ||
| + | |Red | ||
| + | |Green | ||
| + | |Brown | ||
| + | |Blue | ||
| + | |Purple | ||
| + | |Cyan | 0;36 || Light Cyan | 1;36| | ||
| + | |Light Gray | 0;37 || White | ||
| + | |||
| + | ===== Examples ===== | ||
| - | MORE DIRECTIONS TO COME... | ||
| Here are some examples prompts: | Here are some examples prompts: | ||
| Line 11: | 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=" | ||
