Super charge bash with these bash_profile tips

Some tips and tricks to super charge bash

Tip #01: Up down arrow auto complete

~/.inputrc

#File: ~/.inputrc
## arrow up
"\e[A":history-search-backward
## arrow down
"\e[B":history-search-forward

 

Tip #2: Auto complete hostnames in ssh, scp.

More details here.

$ brew install bash-completion

 

Tip #3: Colors and basic aliases

Prompt color, grep search color,  for linux you should add –color in ls/ll aliases.

export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'
alias ll='ls -GFhltr'
alias grep='grep -E --color=always'

 

Tip #4: Change JAVA on demand

Add these functions and pass params such as “1.5”, “1.7”or “1.8”. You will need to have those jvm pre installed.

setjdk() { export JAVA_HOME=$(/usr/libexec/java_home -v $1); }
setjre() { export JRE_HOME=$(/usr/libexec/java_home -v $1); }
setjava() { setjdk $1; setjre $1; }

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *