mkcd
`mkcd` was probably my first ever foray into bash aliases, shell customisation, and the DIY computing spirit that I admire so much.
When you first start playing with the terminal, all you can do is navigate around and make directories. This led me to frustration with the same pattern over and over:
1. make directory
2. navigate into that directory
Why did I have to use two commands every single time? The mental load of running a command was so high as a beginner, this was slowly draining all enthusiasm from my 12-year old mind. Surely there's a better way.
My favourite math teacher used to say all mathematicians are lazy, and will spend any amount of effort coming up with a solution to avoid a small amount of work. If that is true for mathematicians then it is doubly so for programmers.
So I get to googling, how do I solve this problem? And luckily, there was at least one person out there with the same question, and the response was:
"I guess you could make an alias"
Amazing! What is that?
Down the rabbit hole of aliases, sessions, `.bash_profile` vs `.bashrc`, command args, capabilities of functions vs aliases...
And finally, the fruits of my labour:
mkcd () {
mkdir $@
cd $@
}
Now I add it to my `.bashrc` the second I ssh on to a fresh machine, almost by reflex. It's how I learn new syntax when I trying out alternative shells (fish shell my beloved). I get alarmed when an EC2 instance doesn't have it ready for me.
It's how I know that this machine is *my* machine.
---
all glogs
home