Dev Tip: Terminal reload without restart

When you use terminal for development setup often you need to restart it to get new setting in action.
Tonight I was trying to install exhibitor on my personal computer. IT required maven, which was not pre installed on my mac mini (its a new computer). I downloaded the file and found the binary.

➜  ~ wget https://apache.osuosl.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
--2020-11-29 20:43:31-- https://apache.osuosl.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
Resolving apache.osuosl.org (apache.osuosl.org)... 2600:3404:200:237::2, 2600:3402:200:227::2, 2605:bc80:3010::134, ...
Connecting to apache.osuosl.org (apache.osuosl.org)|2600:3404:200:237::2|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9506321 (9.1M) [application/x-gzip]
Saving to: ‘apache-maven-3.6.3-bin.tar.gz’
apache-maven-3.6.3-bin.tar.gz 100%[========================================================================================>] 9.07M 6.22MB/s in 1.5s2020-11-29 20:43:33 (6.22 MB/s) - ‘apache-maven-3.6.3-bin.tar.gz’ saved [9506321/9506321]➜ tar -xf apache-maven-3.6.3-bin.tar.gz; cd apache-maven-3.6.3/➜ apache-maven-3.6.3 file bin/mvn
bin/mvn: POSIX shell script text executable, ASCII text

But until I have it in path, I can not use it. So I added it in my `zshrc`.

# maven path
export MVN_DIR=/Users/vikrantsingh/apache-maven-3.6.3
export PATH=$PATH:$MVN_DIR/bin

But this it self is not sufficient. To get all this working, I have to restart the session to get new config kick in. I found it not cool. So I did following on my command line

source ~/.zshrc

This worked and I was able to reuse the same session. To make it more seamless, I added one alias in my .zshrc .

reloadTermial='source ~/.zshrc'

With above in place, all I need to do it reload<tab>, and enter. New config is loaded without restart.

Bonus Tip

If you like this productivity tip, you will love to know that alias command shows existing aliases on your system.
And I pleasantly surprised to see following alaises for git on my system (not sure if they came with oh-my-zsh).

g=git
ga='git add'
gaa='git add --all'
gam='git am'
gama='git am --abort'
gamc='git am --continue'
gams='git am --skip'
gamscp='git am --show-current-patch'
gap='git apply'
gapa='git add --patch'
gapt='git apply --3way'
gau='git add --update'
gav='git add --verbose'
gb='git branch'
gbD='git branch -D'
gba='git branch -a'
gbd='git branch -d'
gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*($(git_main_branch)|development|develop|devel|dev)\s*$)" | command xargs -n 1 git branch -d'
gbl='git blame -b -w'
gbnm='git branch --no-merged'
gbr='git branch --remote'
gbs='git bisect'
gbsb='git bisect bad'
gbsg='git bisect good'
gbsr='git bisect reset'

Few more (dont miss _for sudo , so cool!)

md='mkdir -p'
rd=rmdir
-='cd -'
...=../..
....=../../..
.....=../../../..
......=../../../../..
1='cd -'
2='cd -2'
3='cd -3'
4='cd -4'
5='cd -5'
6='cd -6'
7='cd -7'
8='cd -8'
9='cd -9'
_='sudo '

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store