This is a custom prompt for zsh and bash
This prompt can display, on a line, one or more of the following:
- Time taken to execute command (if takes longer than 30 secs)
- error code
- hostname
- username
- local git status
- remote git status
- kubernetes cluster and namespace
- path
- ssh client connection
You can install this custom prompt or theme in bash or zsh shell.
copy .prompt to $HOME and add to the end of .bashrc
cp .prompt $HOME/.prompt
echo "source .prompt" >> $HOME.bashrc
source $HOME/.bashrc
Requires oh-my-zsh to work properly in zsh shell https://ohmyz.sh/#install
- add fluent-git.zsh-theme to $ZSH/themes
- add ZSH_THEME="fluent-git" to .zshrc
cp .prompt $ZSH/themes/fluent-git.zsh-theme
echo "ZSH_THEME="fluent-git"" >> $HOME/.zshrc
source $HOME/.zshrc
You will need to set up your terminal to use a patched powerline font so the characters in the prompt will display correctly.
You can get pick a font from here: https://github.com/powerline/fonts
if you want this prompt to be available on machines you ssh into you will need to copy the .prompt file to the server.
- create alias in .bash_aliases
# when using -P arg: copy .bashrc-ssh file and do ssh else just do ssh
__ssh(){
[[ $@ == *'-P'* ]] && echo "Copying bash profile for Fluent-git Prompt" && scp -q -o LogLevel=QUIET $HOME/.prompt $1:/home/$USER/.bashrc
/usr/bin/ssh $@
}
alias ssh="__ssh"
- Restart shell or source .bash_aliases
source $HOME./bash_aliases
once those steps are done next time you ssh with -P arg it will copy over the .prompt to the remote server as your new .bashrc which contains the new prompt
example:
ssh bastion -P