1.1. Customize BASH SHELL
Alexis edited this page Jul 26, 2023
·
11 revisions
.bashrc file:
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Infinite bash history
HISTSIZE=
HISTFILESIZE=
. /usr/share/doc/git/contrib/completion/git-prompt.sh
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
export PS1_HOSTNAME='\[\e[01;33m\]\h '
else
export PS1_HOSTNAME=
fi
PS1=$PS1_HOSTNAME
PS1+="\[\e[01;32m\]\t "
PS1+="\[\e[00;37m\]\u: "
PS1+="\[\e[01;34m\]\w"
PS1+="\[\033[32m\]\$(GIT_PS1_SHOWUNTRACKEDFILES=1 GIT_PS1_SHOWDIRTYSTATE=1 __git_ps1)\[\033[00m\] "
if [ $(id -u) -eq 0 ]; then
PS1+="\# "
else
PS1+="\$ "
fi
export PS1
/etc/inputrc
# Arraws up and down for command search
"\e[A":history-search-backward
"\e[B":history-search-forward
sudo sed -i 's/^.*history-search-backward$/"\\e[A": history-search-backward/g' /etc/inputrc
sudo sed -i 's/^.*history-search-forward$/"\\e[B": history-search-forward/g' /etc/inputrc
For the color in the command:
- Terminator, terminal color themes: https://iterm2colorschemes.com/
- http://bitmote.com/index.php?post/2012/11/19/Using-ANSI-Color-Codes-to-Colorize-Your-Bash-Prompt-on-Linux
- https://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html
- http://unix.stackexchange.com/questions/94299/dircolors-modify-color-settings-globaly
- https://www.npmjs.com/package/color2xterm
- http://www.bigsoft.co.uk/blog/index.php/2008/04/11/configuring-ls_colors
Extras:
- https://makandracards.com/makandra/1090-customize-your-bash-prompt
- http://mediadoneright.com/content/ultimate-git-ps1-bash-prompt
- http://www.thegeekstuff.com/2008/09/bash-shell-take-control-of-ps1-ps2-ps3-ps4-and-prompt_command/
- http://stackoverflow.com/questions/4133904/ps1-line-with-git-current-branch-and-colors
##########################################################################
# FOR GIT
##########################################################################
. /usr/share/doc/git/contrib/completion/git-prompt.sh
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
export PS1_HOSTNAME='\[\e[01;33m\]\h '
else
export PS1_HOSTNAME=
fi
PS1=$PS1_HOSTNAME
PS1+="\[\e[01;32m\]\t "
PS1+="\[\e[00;37m\]\u: "
PS1+="\[\e[01;34m\]\w"
PS1+="\[\033[32m\]\$(GIT_PS1_SHOWUNTRACKEDFILES=1 GIT_PS1_SHOWDIRTYSTATE=1 __git_ps1)\[\033[00m\] "
if [ $(id -u) -eq 0 ]; then
PS1+="\# "
else
PS1+="\$ "
fi
export PS1