This is my current Linux shell prompt. This will show the current Github branch if you are in the folder containing a Git project. But I have added something cool.
git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' } PS1='┌──[\[\033[38;5;160m\]\u\[$(tput sgr0)\]@\[$(tput sgr0)\]\[\033[38;5;75m\]\H\[$(tput sgr0)\]]─[\w]\n└──╼ $(git_branch) ╼ \[\033[34;5;9m\]\$\[$(tput sgr0)\] ' |
I have added this to the prompt. This shows a blue $ sign in my prompt, but it is blinking. This is quite cool.
\[\033[34;5;9m\]\$\[$(tput sgr0)\] |
Add this to your $PS1 and you can make any part of it blink.
This version of the shell prompt will show the machine`s IP address instead of the hostname.
net_ip_addr() { ip a | awk '/inet / { print $2 }' | sed -n 2p | cut -d "/" -f1 } git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' } PS1='┌──[\[\033[38;5;160m\]\u\[$(tput sgr0)\]@\[$(tput sgr0)\]\[\033[38;5;75m\]$(net_ip_addr)\[$(tput sgr0)\]]─[\w]\n└──╼ $(git_branch) ╼ \[\033[34;5;9m\]\$\[$(tput sgr0)\] ' |
This is the shell prompt you will get using this example.
The 'history' command will show you the commands you've used before. Alternatively, you can use the up arrow button to look through them. ┌──[[email protected]]─[~/Videos] └──╼ ╼ $ |
This should be very useful indeed on a network-connected machine.
The version below has a blue square around a blinking $ sign in the prompt. Very cool and different.
net_ip_addr() { ip a | awk '/inet / { print $2 }' | sed -n 2p | cut -d "/" -f1 } git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' } PS1='┌──[\[\033[38;5;160m\]\u\[$(tput sgr0)\]@\[$(tput sgr0)\]\[\033[38;5;75m\]$(net_ip_addr)\[$(tput sgr0)\]]─[\w]\n└──╼ $(git_branch) ╼ \[\e[6;32;44m\]\$\[$(tput sgr0)\] ' |