🔗 Organization Tip #2: Aliases in BASH for Flatiron Tasks, aka “be as lazy as you can be”

Ben Merryman
3 min readDec 22, 2022

--

Always be aliasing

BASH gives us the tools to make our lives much easier! We should use them. Sometimes I feel like aliasing these tasks is somehow cheating…then I remind myself that all of programming is trying to be LAZIER!

Be as lazy as you can be, use aliases.

Note this was originally posted in a Slack chat, formatting kept 90% the same but cleaned up where needed…you would need to modify the aliases to work on your own shell, but the concepts apply universally.

If anyone is wanting some quality of life improvements to your terminal and using BASH (WSL2), here are some aliases you can add to your ~/.bashrc file to speed up some common Flatiron tasks! These aliases should translate to ZSH (Mac) shell also, but I'm not 100% on how that shell does aliasing.

Dip your toes in to aliases:

  1. Open a terminal
  2. Choose an alias to test (i.e. alias e="explorer.exe" ) type it into the terminal or copy-paste and hit enter
  3. Test alias in terminal (i.e. e . command will now open explorer in current directory

Dive right in:

  1. Open a terminal
  2. Run code ~/.bashrc (⚠️ WARNING | this is your shell everywhere, edit at your own risk)
  3. Add in aliases as desired
  4. Restart shell so that aliases will be loaded
  5. Use aliases (such as flatgit + <github URL> ) to perform multiple tasks in one line.
    1. flatgit == function w/ 1 arg to sequentially…
    2. change to current phase dir…
    3. then clone repo…
    4. then change to cloned repo folder…
    5. then launch vscode in current folder

Aliases extracted from ~/.bashrc file

alias e="explorer.exe"
alias r='exec bash'
alias o='code .'
alias be='bundle exec'
# Adding aliases 2022-11-22 for Flatiron School commands
# custom aliases
alias gitcl='git clone'
alias gitam='git commit -am'
​
alias create='npx create-react-app .'
alias npmis='npm install && npm start'
​
alias cdnow='cd ~/Development/code/phase-3/'
alias cdlec='cd ~/Development/code/SENG-LIVE-phase3-112122'
alias cdpro='cd ~/Development/code/phase-3-project'
alias cdrec='cd $(\ls -1dt ./*/ | head -n 1)'
​
alias flat='cdnow; cdrec; o'
alias olec='cdlec; o'
flatgit() {
cdnow
git clone ${1}
cdrec
o
}

Screenshot of aliases loaded on ~/.bashrc file

Code for aliases to be added to ~/.bashrc file to make Flatiron tasks easier

--

--