7 ms·
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
by MikkoFinell 8y ago
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
1 167 16.7% git
2 130 13% ll
3 94 9.4% clear
4 90 9% make
5 80 8% cd
6 57 5.7% e
7 52 5.2% cat
8 45 4.5% man
9 38 3.8% valgrind
10 37 3.7% rm
Where ´e´ is an alias for ´vim´.
- falcolas 8y agoGuessing 'll' is an alias for 'ls -al' or similar as well?
- dicknuckle 8y agoIt's a common alias in Ubuntu systems I believe.
- falcolas 8y agoI'm just doing a confirmation, since I personally completely overwrite the .bashrc with my own, eliminating any default aliases.
- wyclif 8y agoMy output from the same: 1 93 18.6% l 2 75 15% exit 3 60 12% zsh 4 53 10.6% cd 5 47 9.4% nvim 6 20 4% ssh 7 14 2.8% lt 8 14 2.8% ls 9 14 2.8% la 10 10 2% sudo
- isostatic 8y agoClear? I always press ctrl-l
- MikkoFinell 8y agoMe too. But when programming I usually run clear && make all && ./a.out
- anon_mouse 8y agoI can copy/paste your statement and it works.. but when I try to save it as an alias method.. I keep getting error: awk: cmd. line:1: {CMD[]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;} awk: cmd. line:1: ^ syntax error awk: cmd. line:1: error: invalid subscript expression I thought I would just escape the double quotes ", and things would work. :/ Any ideas?
- bmn__ 8y agoThat's not how shell quoting works. I don't want to explain the mistake and the fix. Use a shell function instead of an alias, that's the better tool here.
- arccy 8y agoalias mostused='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'
- gwn7 8y agoMy version: 1 178 35.5289% gi 2 90 17.9641% ls 3 77 15.3693% vim 4 51 10.1796% fg 5 28 5.58882% cd 6 20 3.99202% jobs 7 10 1.99601% date 8 6 1.1976% pass 9 5 0.998004% docker 10 4 0.798403% sudo I know `gi` looks silly as a `git` alias but it has an ergonomic benefit at least for touch typists.
- musicmatze 8y ago1 401 16.04% git 2 337 13.48% fg 3 241 9.64% cargo 4 234 9.36% cd 5 197 7.88% ls 6 195 7.8% tig 7 165 6.6% task 8 81 3.24% vim 9 38 1.52% imag 10 31 1.24% pwd "imag" is my own tool, a personal information management suite for the commandline.
- h1d 8y agoPerhaps you want new tabs for your shell instead of typing 'fg' every so often.
- I_complete_me 8y agoUsing zsh the equivalent command is ->% zsh_stats Sample: 1 102 15.4545% ls 2 53 8.0303% sudo 3 33 5% vim 4 30 4.54545% python 5 29 4.39394% cd 6 20 3.0303% P 7 18 2.72727% which 8 17 2.57576% pip 9 15 2.27273% touch 10 15 2.27273% la 11 13 1.9697% git 12 12 1.81818% kill 13 12 1.81818% PS 14 11 1.66667% ~ 15 10 1.51515% ln 16 10 1.51515% jobs 17 10 1.51515% cat 18 9 1.36364% take 19 8 1.21212% ~\n 20 8 1.21212% snap