This is how my final terminal should look like
nuwans:mediation-dep-gw (master) $
I have removed
This can be done via .bashrc file located in your local home directory. in bashrc file PS1 variables handles the terminal prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='\[\033[01;32m\]\u:\[\033[01;34m\]\W\[\033[00m\]$(parse_git_branch) $ '
else
PS1='\u:\W\$ '
fi
Paste above code to the bashrc file to update the existing code.
What I have done?
PS1='\[\033[01;32m\]\u:\[\033[01;34m\]\W\[\033[00m\]$(parse_git_branch) $ '
PS1 - sets the terminal pattern used by linux os.
\[\033[01;32m\] - setting the colour
\u - user name
\W - current folder
$(parse_git_branch) - will read git branch info and if its not git folder empty value is retured.
nuwans:mediation-dep-gw (master) $
I have removed
- lengthy host name,
- very long directory structure
- and added git branch
This can be done via .bashrc file located in your local home directory. in bashrc file PS1 variables handles the terminal prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='\[\033[01;32m\]\u:\[\033[01;34m\]\W\[\033[00m\]$(parse_git_branch) $ '
else
PS1='\u:\W\$ '
fi
Paste above code to the bashrc file to update the existing code.
What I have done?
PS1='\[\033[01;32m\]\u:\[\033[01;34m\]\W\[\033[00m\]$(parse_git_branch) $ '
PS1 - sets the terminal pattern used by linux os.
\[\033[01;32m\] - setting the colour
\u - user name
\W - current folder
$(parse_git_branch) - will read git branch info and if its not git folder empty value is retured.
Comments
Post a Comment