Life is short, bash commands should be too

July 2021 • 1 min read

As a person that likes to maximise my output and minimise the input required, I don’t like having to type and re-type all my bash commands repeatedly during the day. Thankfully, I can create aliases on my machine that shorten them.

These are my favourite:

I especially like the functions because I can shorten long commands that have variable input. e.g. to start an ssm session, I just have to type:

run_ssm <instance-id> <region>

My second favourite thing is being able to combine two shortened commands. e.g.

# old - git push origin chore/do-some-amazing-thing-with-code
gpo `get_branch`

How to use (OS X)

  1. Open your .bash_profile file

     nano ~/.bash_profile
    
  2. Paste any of the commands in and save it
  3. Update the shell session with the new content

     source ~/.bash_profile
    

I will add more commands to the gist as the need for them comes along. Feel free to add your favourites to the gist too!

Hi! My name is Opeyemi. I am an SRE that cares about Observability, Performance and Dogs. You can learn more about me or send me a message on Twitter.

Share on