Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Avoiding Shell Hell: Aliases to the rescue

Avoiding Shell Hell: Aliases to the rescue

Aliases are a hack to developer productivity. Developers spend a couple of time typing long commands from Git to Docker and Kubernetes when these could be aliased saving us the time to achieve more. In this talk, I will expand on the tips and tricks developers can apply to achieve more in less time. Presented at forLoop Lagos Summit

Chiamaka Ikeanyi

March 08, 2019
Tweet

More Decks by Chiamaka Ikeanyi

Other Decks in Technology

Transcript

  1. Avoiding Shell Hell: Aliases to the rescue Lagos Summit 2019

    | Chiamaka Ikeanyi March 8, 2019 @ Zone Tech Park, Gbagada
  2. Chiamaka Ikeanyi chiamakaikeanyi.dev @chiamakaikeanyi Poet & Writer Software Engineer at

  3. @chiamakaikeanyi

  4. @chiamakaikeanyi

  5. gc? @chiamakaikeanyi

  6. An alias to git commit @chiamakaikeanyi

  7. Say hello to Aliases @chiamakaikeanyi

  8. What is an alias? @chiamakaikeanyi

  9. An alias is an alternate name for a command. Just

    a shortcut. @chiamakaikeanyi
  10. Why are aliases important? @chiamakaikeanyi • Spend less time typing

    • Reduce the chances of typos in a long command • The secret to speeding up your terminal workflow
  11. docker ps | grep forloop Is this cool? @chiamakaikeanyi

  12. dgp forloop What of this? @chiamakaikeanyi

  13. @chiamakaikeanyi Consider this Scenario Client 1 Website You $ kubectl

    get pods | grep $podName $ kubectl logs $podName $ kubectl exec -it $podName bash Client 2
  14. @chiamakaikeanyi

  15. Aliases instruct the shell to replace one string with another

    when executing commands. @chiamakaikeanyi
  16. • Git • Docker • Kubernetes • . . .

    Popular usage @chiamakaikeanyi
  17. isLong && repetitive ? alias : null Alias every command?

    @chiamakaikeanyi No, Not really
  18. Who needs to use aliases? @chiamakaikeanyi

  19. Lazy software engineers @chiamakaikeanyi

  20. gac "Fix filters" gpo patch/filters git add . git commit

    -m "Fix filters" git push origin patch/filters Works Smart Works Hard
  21. How can you add aliases? @chiamakaikeanyi

  22. Syntax alias name=command @chiamakaikeanyi

  23. Syntax alias name="command with space" @chiamakaikeanyi

  24. Store in the home directory @chiamakaikeanyi

  25. Bourne-again shell (Bash): ~/.bashrc or ~/.bash_profile Z Shell (ZSH): ~/.zshrc

    Default Files @chiamakaikeanyi
  26. echo $SHELL cd ~ ls -la touch ~/.bash_profile Not Found?

    @chiamakaikeanyi
  27. alias workspace= "git config user.name 'your_name' && git config user.email

    'your_email'" @chiamakaikeanyi
  28. alias blog="open https://chiamakaikeanyi.dev" @chiamakaikeanyi

  29. alias nis='f(){ npm install --save "$@" }; f' @chiamakaikeanyi

  30. source ~/.zshrc or . ~/.zshrc Reload @chiamakaikeanyi

  31. nano ~/.zshrc open ~/.zshrc code ~/.zshrc alias @chiamakaikeanyi Accessing your

    Aliases NB: Substitute .zshrc with the shell you’re using - .bashrc or .bash_profile ...
  32. BASH @chiamakaikeanyi

  33. At the end… What matters is becoming more productive @chiamakaikeanyi

  34. Demo Let’s see an example @chiamakaikeanyi

  35. https://github.com/chiamakaikeanyi/dotfiles Resource @chiamakaikeanyi

  36. Tomorrow is mystery But you can save time By using

    Aliases - Chiamaka Ikeanyi @chiamakaikeanyi Yesterday is history
  37. Thank you chiamakaikeanyi.dev @chiamakaikeanyi