Recently I came across a thread on reddit which asked users the most used command in their shell history.
My results:
1 419 13.0489% git
2 265 8.25288% cd
3 239 7.44316% sudo
4 122 3.79944% cat
5 77 2.39801% which
6 76 2.36686% dkr
7 72 2.24229% rm
8 60 1.86858% rg
9 57 1.77515% yarn
10 57 1.77515% nvim
Obviously git
is my most used command because I ran it on my work laptop. It should be a lot more but I have been using prezto's git
aliases lately. Other common commands are dkr
which is an alias for sudo docker
and rg
, the binary for ripgrep.
I wonder how is it for the dev.to community?
Use this command from linux.byexample.com to list your most used commands:
history | 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
I use zsh and it was not working for me because zsh's history
command just prints a few most recent commands only. I had to tweak it a bit:
history 1 | cat | 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
# or
fc -l 1 | 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
Latest comments (31)
aka a bunch of git shortcuts, the infamouse
npm
fornpm start
on all my projects, yet more git stuffnumber 11 is nvim with 51 :D
Flutter, am I right?
I mainly work via ssh, so my total commands differ there.
On my main VM lots of DNS queries, talking to other machines and inline loops; and oh, some heavy ansible testing made its way to the top 10
I'm more of a sysadmin guy as you might have guessed by
git
being only on 7 :DI honestly didn't expect qemu to be there lol
I might be a software engineer by title, but really a sysadmin by necessity.
I didn't expect to see
exit
andclear
so much but I suppose it makes sense with all thetmux
panes being created and destroyed and my habit of clearing the screen when switching between tasks.Ctrl+D and Ctrl+L?
Git also wins for me. :) php would be second when combining php and sf.
g
- git,s
- sublimeAre you using self-defined aliases for git or the ones defined by a bash/zsh framework?
I've manually added the following lines in my
.bashrc
file:if the terminal is your IDE:
1 146 14.6% vi
2 137 13.7% ls
3 96 9.6% cd
4 64 6.4% eog
5 52 5.2% git
6 44 4.4% ssh
7 38 3.8% cat
8 32 3.2% rm
9 26 2.6% su
10 26 2.6% make
I've been doing some facial recognition scripting recently (hello eog), and apparently I like other computers (ssh), nuking stuff (rm) and root :)
quite glad to see make get in at 10!
Where
gstt
is my alias forgit status
Depending on your distribution, the "only X number of lines of history are printed" is the default behavior. For
bash
andksh
, subbingfc -l 1
forhistory
usually suffices.No surprise here. git, cd, ls, vim, build, search
You might want to look into autojump or autojump-rs to quickly jump to your workspace directories.
Also, ripgrep is a competent (not drop-in though) alternative to ag/grep.
Thanks. I've found that autojump and the like are too non-determistic to be reliable.
ripgrep is missing two very critical features: -G (--file-search-regex) and the ability to grep gzip'd files. The ripgrep vim plugin is also sub-par to ag's.
ripgrep is certainly faster, but they're both so fast their difference is often in ms.