5 Terminal Tricks I wish I knew sooner
July 21, 2019
As a developer, your terminal is kind of like your living room
- you spend a disproportionate amount of time there
- a little houskeeping can equal a lot of happiness
so here’s 5 low effort, high leverage bash terminal tricks
Over time, you accumulate little tricks to optimize your terminal…
Here are some low-effort, high-leverage tricks I’ve picked up over time.
Given how simple they are, you can start using all of them right now, with no learning curve.
1) alias everything
You probably know about aliases, and maybe even use a few.
But you should probably be using it more, a lot more.
For almost any command I run multiple times a day, I’ll make an alias by editing
and so on.
Is it hard to remember all these aliases?
Actually, surprisingly not, after you use them a few times.
Just add your most common ones at first build your way up.
2) window stacking
I use iTerm as my terminal of choice.
I can’t remember when I started using it, but I do know that its window stacking feature constantly in use for me.
I use it to logically group things while multi tasking, or to run multiple servers / processes at the same time
Looks cool too (imo)
open a new stacking window
- horizontally with
cmd + d
- vertically with
cmd + shift + d(my go-to)
3) VI(m) syntax highlighting
Every dev should at least know some basic VIM for sever configuration, quick edits, etc.
Syntax highlighting helps you write less errors in VIM and there are no installs required.
It’s such a simple trick that I am embarassed it took me so long to figure out.
Just open (or create)
just add one line:
Subtle, but way better (imo)
If you want to further customize VIM, there are tons of VIM plugins.
4) PS1 customization
Your bash PS1 prefixes every command you type with this nifty tool:
Create a custom prefix with the bashrc generator
Then paste it by opening
Apart from prefixing your commands with your favorite color, you also get the directory name right there, no more
prints json files and streams into nicely formatted, colorized outputs.
For this to work, just.
brew install jq
then just pipe a json call into jq by appending
| jq .
curl https://entrylevelsoftwarejobs.com/api/jobs | jq .
check out the before and after
you can also use
jq on a file,
jq . package.json
…can be used for getting specific properties from JSON files…
jq .scripts package.json
…and even more if you want to check out the docs.
- create aliases for everything in
~/.bashrcto speed everything up
- stack windows in
cmd + (shift) + d
- turn on vi syntax highlighting with
jq .to format and colorize json
- you can generate a custom command prompt here