DEV Community

Cover image for One bash command to start the day 🌅

One bash command to start the day 🌅

Doaa Mahely on August 23, 2020

When I first started at my current job, I was using my personal laptop. Being a stickler for the separation between work-time and non-work-time, I ...
Collapse
 
didacsf profile image
Dídac Sementé Fernández

One thing I do in my own laptop is make a separate account for my work user and another one for my personal user. That way I don't need to worry about one thing interfering with the other.

Collapse
 
dmahely profile image
Doaa Mahely

That's a good idea as well

Collapse
 
bogdaaamn profile image
Bogdan Covrig

Great post and idea! I recently got into shell scripts as well trying to automate some stuff.

Not yet ready to share the full code because is quite trashy 👀 but this is a little snippet making, changing, and opening a directory in code for a fresh new project.

# MKDIR with the inputted name. If already exists, just ignore, continue anyways      
tput setaf 0; echo -n "Creating directory... "
mkdir $flpath 
tput setaf 2; echo "done."

# CD to the inputted folder
tput setaf 0; echo -n "Changing directory... "
cd $flpath 
tput setaf 2; echo "done."

# OPEN CODE from the folder
tput setaf 0; echo -n "Opening VS Code... "
code -n . 
tput setaf 2; echo "done."

Really loved finding out about tput setaf changing the color of the text in the terminal, it makes it look cooler.

Terminal new command

Also nice trick source ~/.new-sh-script.sh in the zsh config file and it loads the new (or any other function) in the terminal as a command.

Collapse
 
dmahely profile image
Doaa Mahely • Edited

This is really cool! That's gonna be a very useful script. I look forward to seeing the final result 😄

Collapse
 
dlamblin profile image
Daniel Lamblin

This changed my life with bash:

CDPATH The search path for the cd command.  This is  a  
       colon-separated list  of  directories  in  which the
       shell looks for destination directories specified by
       the cd  command.   A  sample  value  is ".:~:/usr".

EG put all your projects in a project directory, add it to your CDPATH, and you can tab complete your project directory names with cd from any path any time.

Collapse
 
mshjri profile image
Omar Al-Mashjari

Well, that is especially helpful while working from home.
8:59 AM - Home
9:00 AM - Work!!

Collapse
 
jimpriest profile image
Jim Priest

I do something similar on may Mac using Alfred - I just enter 'work' and it pops open all my email, editor, browser and Slack/Teams, etc. Lazy for the win!

Collapse
 
dmahely profile image
Doaa Mahely

That's awesome! I tried using Alfred some time ago but couldn't get used to it.

Collapse
 
phase_seven profile image
Ratul Roy

Cool post! I usually put all my command in one python script, and run it after opening my workstation.

Collapse
 
equiman profile image
Camilo Martinez

My favorite one 🤓

alias x="exit"
Collapse
 
kewbish profile image
Emilie Ma

Did something similar to this - automation for the win! Saves a ton of time as well.

Collapse
 
andrewbaisden profile image
Andrew Baisden

Reading this article makes me want to automate my whole workflow it would save me a ton of time that would be better spent doing other things.

Collapse
 
herico profile image
Mamadou Korka Diallo

This is very neat and really productive. thanks

Collapse
 
winnieire profile image
Irene Sarigu

Thanks for this information! 😊

Collapse
 
dmahely profile image
Doaa Mahely

Thanks for reading Pavel 😄

Collapse
 
armujahid profile image
Abdul Rauf

Nice! I also have similar startup script except I use browser's built in tab restore feature to restore my browser session with all tabs.

Collapse
 
samborick profile image
Sam Borick

I do this too! I also start a toggl timer via their rest api. And I create standard 'getting started' checklist via the todoist.

Collapse
 
ritwikshanker profile image
Ritwik Shanker

Great Article. A note for people who use Macbook's, you can use Automator tool which is inbuilt inside the system. Will really help you avoid 5-6 clicks in the morning.

Collapse
 
dmahely profile image
Doaa Mahely

I'll have to take a look at the automator, thanks

Collapse
 
villival profile image
villival

kudos