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!

To help me grow on Youtube and learn about Monitoring, Machine Learning, and SRE, please subscribe here.

And to get notifiied about new posts, please subscribe here.

Share on