Variables#
PS1 PS2 PS3
Escape Codes Used in Shell Prompts#
| Sequence | Value Displayed |
|---|---|
| ASCII bell | |
| ̣ date in day, month, date format | |
| ̉ Hostname | |
| ̋ Full hostname | |
| ȷ | Number of jobs running |
| ł | Name of current terminal |
| Newline | |
| ̊ Carriage return | |
| Name of the shell program | |
| ͡ Current time in 24-hour hours:minutes:seconds format | |
| Current time in 12-hour format | |
| \@ | Current time in 12-hour AM/PM format |
| Current time in 24-hour hours:minutes format | |
| ̆ Username of the current user | |
| ̌ Version number of the shell | |
| Version and release numbers of the shell | |
| Name of the current working directory | |
| Last part of the current working directory name | |
| \! | History number of the current command |
| \# | Number of commands entered during this shell session |
| \$ | Displays a "$" char unless superuser then "#" |
| [ | Signals the start of a series of one or more non-printing chars. |
| Moves cursor, changes colors, etc | |
| ] | Signals end of non-printing char sequence |
Colors#
-
Foreground
Sequence Text Color \033[0;30m Black \033[0;31m Red \033[0;32m Green \033[0;33m Brown \033[0;34m Blue \033[0;35m Purple \033[0;36m Cyan \033[0;37m Light gray \033[1;30m Dark gray \033[1;31m Light red \033[1;32m Light green \033[1;33m Yellow \033[1;34m Light blue \033[1;35m Light purple \033[1;36m Light cyan \033[1;37m White To set the terminal back to normal: \033[0;30m
-
Background
Sequence Background Color \033[0;40m Black \033[0;41m Red \033[0;42m Green \033[0;43m Brown \033[0;44m Blue \033[0;45m Purple \033[0;46m Cyan \033[0;47m Light gray -
Cursor Movement
Escape Code Action \033[l;cH Move the cursor to line l and column c \033[nA Move the cursor up n lines \033[nB Move the cursor down n lines \033[nC Move the cursor forward n chars \033[nD Move the cursor backward n chars \033[2J Clear the screen and move the cursor to the upper-left corner (line 0, column 0) \033[K Clear from the cursor position to the end of the current line \033[s Store the current cursor position \033[u Recall the stored cursor position