Skip to content

Instantly share code, notes, and snippets.

@jmlclosa
Last active October 29, 2019 18:21
Show Gist options
  • Save jmlclosa/18e3e1b11dc437354bd94648635182e4 to your computer and use it in GitHub Desktop.
Save jmlclosa/18e3e1b11dc437354bd94648635182e4 to your computer and use it in GitHub Desktop.
bash_terminal_tips

Use ZSH + Oh My Zsh

Recommended Zsh Plugins

plugins=(
  git mvn history httpie docker kubectl
)

Some good alias

mvnci
mvnp
mvncist

gcm
gcd
gl
gfa
gba
gbda

Custom alias

# starts one or multiple args as programs in background
background() {
  for ((i=2;i<=$#;i++)); do
    ${@[1]} ${@[$i]} &> /dev/null &
  done
}

alias java11="export JAVA_HOME=/usr/lib/jvm/jdk-11.0.3+7/ & sudo update-alternatives --set java /usr/lib/jvm/jdk-11.0.3+7/bin/java & sudo update-alternatives --set javac /usr/lib/jvm/jdk-11.0.3+7/bin/javac"
alias java8="export JAVA_HOME=/usr/lib/jvm/java-8-oracle/ & sudo update-alternatives --set java /usr/lib/jvm/java-8-oracle/bin/java & sudo update-alternatives --set javac /usr/lib/jvm/java-8-oracle/bin/javac"
alias gwork="git config --global user.name 'jlopez' && git config --global user.email 'jmlopez@brujula.es'"
alias ghome="git config --global user.name 'Juanma' && git config --global user.email 'jml.closa@gmail.com'"
alias mvnwork="cp -f /home/juanma/.m2/settings_ctm.xml /home/juanma/.m2/settings.xml"
alias mvnhome="cp -f /home/juanma/.m2/settings_home.xml /home/juanma/.m2/settings.xml"
alias at_home="ghome && mvnhome"
alias at_work="gwork && mvnwork && background sh /opt/forticlient-sslvpn/forticlientsslvpn.sh"
alias -g L='| less'
alias -g G='| grep'
alias copy="xclip -sel clip"
alias cp!='fc -ln -1 | awk '\''{$1=$1}1'\'' ORS='\'''\'' | copy'

Terminal shortcuts

CTRL+L clears terminal CTRL+U clears from cursor to beginning of line CTRL+K clears from cursor to end of line CTRL+D clears one character to the right of the cursor

Some extensions/applications

z -> https://github.com/rupa/z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment