The Top 10 Shell Commands To Be More Productive

・3 min read
The Top 10 Shell Commands To Be More Productive

Some time ago I’ve found an interesting article / primer to bash scripting.

What interested me mostly, though, was command that displays top 10 commands I’ve used:

1history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl |  head -n10

As I have successfully moved from RubyMine IDE to Vim / shell for git
, it’s not a surprise that my top 10 is was:

1   163  44.2935%   git
2   50   13.587%    cd
3   32   8.69565%   vagrant
4   17   4.61957%   ember
5   9    2.44565%   .
6   8    2.17391%   cat
7   7    1.90217%   pwd
8   7    1.90217%   ln
9   6    1.63043%   pg_ctl
10  5    1.3587%    ps


1   3886  38.8639%   g
2   1444  14.4414%   git
3   544   5.44054%   ember
4   392   3.92039%   cd
5   346   3.46035%   npm
6   292   2.92029%   ls
7   200   2.0002%    rm
8   137   1.37014%   rspec
9   128   1.28013%   cat
10  117   1.17012%   rails

I have collected more data, but a few things deserve some explanation:

g vs. git

A team member, Maciek, made me realize that with zsh shell I can replace gitwith g alias. It took me roughly 3 weeks (21 days) to get out of the habit of using git and replace it with g.

I observed the 21 days to change habits principle2 over and over again during past few months. It took me similar amount of time to switch from :w to [CMD] + [S] in MacVim.

I’ll write a separate post about that as this kind of life-hacking interests me most.

Git as Vim is my Swiss Army knife. Knowing what’s going on gives you performance boost and confidence to try out alternative solutions.

It is also worth noting that with ember-cliember and npm are my next most used commands.

Though cd has the same length as .. (zsh alias), zsh allows me for .... (cd ../../ if you’re wondering)

Using Vim / shell made me more aware what’s going on, about patterns I come across and, in turn, how to optimise them.


The original git aliases

1rb = rebase

are gradually being replaced with either aliases from zsh like:

1# Before (`git com`)

or custom ones:

1# .zshrc

After all, g rbi head\~10 is better than: git rebase -i head\~10, don’t you think?!

I also noticed that using short aliases like g rbi play nicely with history search (C-R). Searching for full version, e.g rebase -i (or rebase to be faster) returns more ambiguous results. Another small win! :)

It may seems to be an exaggeration, art for the art’s sake, but I don’t care.

One keystroke less a day, keeps carpal tunnel syndrome surgeon away! – Ryrych W.

Still not convinced? Read how best count each keystroke.


Originally I wrote:

Another pattern I used over and over again concerned pushing __local_feature branch__ to __origin__ (the same branch name).

1git push -u origin feature_some_branch_with_fancy_name

Most often autocompletion is not enough, so I found this command in some gist:

1gbn () {

With this, it’s better:

1git push -u origin $(gbn)

I stopped using it after some time. Perhaps it wasn’t that powerful. :)


Web developers use git on a day to day basis from shell or some IDEs like RubyMine. There may be time when you hit the wall when RubyMine will make some mess with your VCS. You will have to fall back on CLI version of this VCS. Wouldn’t it better to challenge yourself and switch to CLI version now?

You won’t regret it! You will be able to even shout Brag. Blog. Blob!


Love these titles:

  1. It’s less overrated than Pareto Principle 

Related articles