Command Line Aliases
Your command line supports aliases which allows you to reduce the keystrokes required to get the same job done.
For example, instead of php artisan migrate:fresh --seed
you could use mfs
.
This reduces the keystokes from 32 to 3.
With dozens to hundreds of command line interactions every workday you could save yourself significant time by setting up some simple aliases for the most common commands.
Sanity check:
5 seconds saved per command
* 100 commands per worlday
* 5 work days per week
* 50 weeks per year
/ 3600 seconds in an hour
= 34.7 hours saved per year
What does an alias look like?
The standard format for an alias looks like this:
ALIAS mfs="php artisan migrate:fresh --seed"
On my Mac I keep them in a file called .bash_profile
in my Home folder, on my Windows machine it's called .bashrc
. Regardless of what it's called, it just needs to be loaded by your terminal/command line when it starts up.
This file can include other Terminal config settings (e.g. custom colour schemes). Some people extract a dedicated alias file that they load in via the main bash file but at this point I don't need to.
This post isn't a guide on how to set it up, just that it exists and some intuition for why you might want to.
My secret advice
The first alias you should setup is a way to easily add more aliases.
While this is amusing on a meta level, the reality is you'll only add aliases if it's easy.
That's why I always set (on my Mac, adjust accordingly):
ALIAS addalias="nano ~/.bash_profile"
So when I want to add a new alias I type addalias
and away I go.