What's Your 20 Most Used Commands As normal user and root?
Code:
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 -n20 Code:
User: |
Hrm... interesting...
At work, my normal user account looks like this... Code:
1 233 23.3% ls |
Quote:
I have an aliases called connect which connects me to my ssh server. |
Code:
user: What's the empty string from my user account? |
Interesting idea. The history for this one account does not go back too far, but it is this:
Code:
1 180 14.1176% ls |
As myself:
Code:
1 303 30.3% ls Code:
1 96 19.2% ls |
I have an irrational dislike for long pipelines of commands that can be shortened with liberal use of "awk". Yes, I know it's ridiculous when taken to extremes. But I think learning just a little "awk" is well worth it to avoid running 6+ processes in a pipeline, possible with multiple "awk" calls, when 2 might work with a just a little more code added.
So here's a rework of that commandline that's just "history" and one "awk" for your amusement. Code:
history | awk '{CMD[$2]++;count++;} END { spot=1; for (a in CMD) { apc=CMD[a]/count*100; if(apc>TOP[spot]) { TOP[spot]=apc; DESC[spot]=sprintf("%5d %5.2f%% %s", CMD[a], apc, a); for(ii=20;ii>=1;ii--) if(TOP[ii] < TOP[spot]) spot=ii } } for(ii=1; ii<=20; ii++) { spot=1; for(jj=1; jj<=20; jj++) if(TOP[jj]>TOP[spot]) spot=jj; printf "%2d %s\n", ii, DESC[spot]; TOP[spot]=0 } }' And as long as I'm posting, here's what I got on my Ubuntu desktop. Code:
1 160 16.00% ls Also, no idea why the original commandline was filtering out anything that started with "./". That seems odd to me. Yes, those are probably local scripts, but it's still interesting IMO. |
Person shows up and asks for your root and user top 10 bash commands?
No way. No how. Code:
1 666 6.95253% nacho |
It is so bad that my top command is sudo? :D
I cut the " | head -n20" off of that to find out how many commands it requires to fulfill 100% of my commands. Well ... I didn't add it up to validate that it was 100%, but the list ran out to 57 total commands. Interesting, and "whatever". I figured that ls, cd, cat, vi, tar, and man would be some of my tops. Just didn't think that sudo and echo would also be there. Glad to see that exit was up there though! Means I properly quit my terminal sessions, heh-heh! |
LOL, at home(\media:)
Code:
1 33 40.2439% sudo Code:
1 8 57.1429% apt-get |
I do not keep a history.
1.) ls 2.) cd (...) i.) vi/gvim (...) The rest, I do not know. |
My laptop 75% of the time is this VM:
Code:
1 73 27.037% sudo Code:
1 1 100% history Code:
1 99 22.8111% sudo Code:
1 6 18.1818% apt-get |
Quote:
|
;)
I was just coming back to post that, home has had the same install for years and the laptop a few months. |
Quote:
|
All times are GMT -5. The time now is 04:28 PM. |