Answers for "linux customize prompt"

1

bash edit prompt display appearance

# syntax:
# export PS1='<Format required>'

# example:
export PS1='\[\033[1;33m\]\u@\[\e[0;36m\]\h:\[\e[1;32m\]$(pwd)\[\e[1;32m\]>  \[\033[1;37m\]'

#===========================================================================================

# + ----------- + ----------------------------------------------------------- +
# | USABLE CODE |  WHAT THE CODE REPRESENTS                                   |
# + ----------- + ----------------------------------------------------------- +
# |     \u      | username                                                    |
# |     \h      | hostname                                                    |
# |     \w      | Full path of the current working directory (uses ~)         |
# |   $(pwd)    | Full path of the current working directory (doesn't use ~)  |
# |     \[      | Begin sequence of non-printing characters                   |
# |     \]      | End sequence of non-printing characters                     |
# + ----------- + ----------------------------------------------------------- +

# + -------- + ------------ + 
# |   CODE   | COLOR        | 
# + -------- + ------------ + 
# | \e[0;30m | Black        | 
# | \e[1;37m | White        | 
# | \e[0;31m | Dark Red     | 
# | \e[1;31m | Light Red    | 
# | \e[0;32m | Dark Green   | 
# | \e[1;32m | Light Green  | 
# | \e[0;33m | Dark Yellow  | 
# | \e[1;33m | Light Yellow | 
# | \e[0;34m | Dark Blue    | 
# | \e[1;34m | Light Blue   | 
# | \e[0;35m | Dark Pink    | 
# | \e[1;35m | Light Pink   | 
# | \e[0;36m | Dark Cyan    | 
# | \e[1;36m | Light Cyan   | 
# | \e[0;37m | Dark Gray    | 
# | \e[1;30m | Light Gray   | 
# + -------- + ------------ +
Posted by: Guest on May-18-2020
2

linux customize prompt

# environment variable PS1 to customize prompt
# \u current user
export PS1="\u : "
#example
username:
Posted by: Guest on June-12-2021
-2

change bash prompt

PS1="\w> "
Posted by: Guest on March-16-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language