Increase your terminal productivity
27 May 2019 Terminal
The terminal
Most developers and designers use the terminal everyday but it can be tough to learn all the pre-written aliases that speed things up for you.
I'll go over some of the aliases and techniques I use to speed things up a bit 🚀
Assumptions
I'm on OSX and using Homebrew, ZSH and iTerm2 as my terminal.
Install Homebrew
Install iTerm2
Install ZSH
Out of the box
Now that you have these three things installed, it is already easier to do a lot of stuff
Homebrew
As you saw above, installing applications is really simple with Homebrew. It's also as easy to update and remove them.
ZSH
Now that you're using ZSH, auto_cd
will be enabled by default.
This means that instead of typing cd mydir/anotherdir
, you can omit the cd
altogether.
Tab completion should also be set up so if you start typing a command or a filepath, hit tab and options will be shown to autocomplete your command.
iTerm2 themes
You can customise iTerm2's themes so that they look pretty cool:
Check out this link for instructions on how to style yours.
Aliases
You may find yourself typing the same commands over and over again, maybe even a sequence of commands.
Aliases allow you to write your string that will perform any given command.
Now that you're using ZSH, in your home directory (cd ~
) there will be a hidden file .zshrc
.
Open that file:
In there you'll see a bunch of config code, most of it commented out. Have a look through it to see if there's anything in there you'd like to enable.
Once you're done, scroll right to the bottom and you'll see some aliases.
You'll now be able to write your own aliases using the following syntax.
My own .zshrc
file looks like this:
You'll can see my installRun
alias contains more than one command that I've strung together using the &&
operator.
Git
I find the built in alias gcam
particularly useful when commiting files to my git repositories.
It means that instead of writing:
I can simply write:
Some other useful built in aliases that speed up your git workflow:
The list of git aliases is huge so it's worth looking them up to decide which are most useful to you.
Have fun!