Easy bash prompt: http://ezprompt.net/
echo $SHELL
For Global change:
sudo vi /etc/bash.bashrc
For Local change:
~/.bashrc or ~/.bash_profile
echo $SHELLls -al ~/.vi ~/.bashrcvi /etc/bashrcecho -e "\e[31mHello ${USER}!\e[0m"sudo susu ec2-usersource ~/.bashrc
$ vi ~/.bashrc
echo -e "\e[31mHello ${USER}!\e[0m" $ source ~/.bash
Example 3: Welcome message
echo "Welcome ${USER} to Node1!"
To show current branch name in Ubuntu Terminal type below commands to related lines in the ~/.bashrc:
Find “PS1” in .bashrc like:
if [ "$color_prompt" = yes ]; then
PS1= ...
else
PS1= ...
fi
instead of above lines, paste blow lines
# git branch info if present
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[33m\]$(parse_git_branch)\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ '
fi
No comments:
Post a Comment