Skip to main content

Command Palette

Search for a command to run...

I've automated my morning routine πŸ€–

Published
β€’2 min read
I've automated my morning routine πŸ€–

Call me lazy, but I just love automating things. Today we are automating my morning routine.

You may be wondering what that routine is.

  • Make coffee (Shit, we won't automate this, Yet!)
  • Open 10 tabs

Yes, that last part we are automating using the magic and mighty bash!

See here how cool this project is:

bash chrome opening

Bash opening browser tabs

Note: This script is written/tested on Mac and can differ for you on different machines.

First, we will be making a plain old .txt file that will hold all the pages we want to open:

https://hashnode.com/
https://daily-dev-tips.com/
https://twitter.com/

Now we will be making a bash script to open all browser tabs:

alias google-chrome='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome'
while read line; do
    google-chrome --new-tab "$line"
done < ~/www/browser-hack/list.txt

I have defined the alias for google-chrome; I think on windows, you can leave the alias out (untested).

Then we will loop through each line defined in list.txt and call google chrome to open a new tab for that website.

Next, we can add an alias to make it even cooler:

alias morning=~/path/to/script/bash.sh

Now in your terminal type: morning and see the magic happen

Voila, we just hacked our morning routine to be that much quicker!

You can find this project on Github: Browser-hack

Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter

A

Bash to open tabs ? Please. Try Workona. It saves my life :) I have on it different profiles and change opened tabs between each other so fast.

P

Haha nice. Let me know once you got a shell script to make coffee 🍡️

1
C

Getting my Arduino in today or tomorrow so hopefully soon! πŸ˜‚

R

Thanks for this post! This stuff looks so good for devs, gonna start writing my bash scripts today ;)

1
C

Hey Ritvij, nice! glad it inspires you, let us know what your making

1
P

Super cool, nice one Daily Dev Tips

1
C

Thanks! Glad you like it πŸ™

R

This is crazy. Love this man πŸ”₯

1
C

Thank you Rutik, automation is the bomb πŸ’£

S
Skay5y ago

Brilliant post!! Love it πŸ™Œ

1
C

Thanks Skay, automate everything! πŸ”₯

1
S

Very cool

1
C

Thanks! Love using bash for simple things

S

This is rad πŸ₯° Daily Dev Tips

2
C

Thanks Syed, you seem like the person who also makes scripts like this for simple tasks?

More from this blog

D

Daily Dev Tips

887 posts

Looking to get into development? As a full-stack developer I guide you on this journey and give you bite sized tips every single day πŸ‘Š