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
Top comments (31)
Outside the usual suspects, pacman is the Arch Linux package manager and mocha is a JavaScript test framework. I'm actually a little surprised the latter made the top 10.
for a moment I thought you had a version of Pacman installed in the terminal
I mean, it exists, but I was never any good at Pacman :D
ahhahaha me neither.
I'm more of a Space Invaders person.
Flutter, am I right?
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:I honestly didn't expect qemu to be there lol
How is pipenv working out for you? Is it comparable to yarn or cargo in your experience?
I use pyenv (to have multiple Python versions installed) and pipenv a lot.
I don't know about cargo but pipenv is not that different from yarn. It has a file with the list of dependencies and a lock file. It tends to consume less resources than yarn because Python dependencies trees are usually much smaller than those of JS libraries.
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!
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.
Surprised that
brew
,pg_upgrade
, andpg_restore
are there. Wonder if it take your most recent commands from the previous week.Probably depends on how your shell history is set up. Things like whether concurrent sessions are set up to aggregate history, whether session's shell-history is configured to save to disk at all, how large you've set your
HISTSIZE
, etc. will all play in.