Which Linux terminal command do you use the most?

Chat about Linux in general
rene
Level 8
Level 8
Posts: 2187
Joined: Sun Mar 27, 2016 6:58 pm

Re: Which Linux terminal command do you use the most?

Post by rene » Sat Sep 08, 2018 9:08 am

BG405 wrote:
Fri Sep 07, 2018 9:11 pm
I'd be interested to find out how to filter out the display of the history result, which is affected by executing this, would help me to understand how this works .. will have to explore all this. I'm intrigued now. :)
Although I'm inclined to myself feel that being intrigued by 'awk' in 2018 might not necessarily lead to the best use of one's time... if you in the second version I posted, the one that filters commands starting with "./", replace the "$2!~/^.\//" [edit: which actually should escape the . as well] with "$2!~/^history/" that would work. Or filter both with "$2!~/^(\.\/|history)/". Just keep adding "|foo|bar" inside the parentheses to filter additional commands.

Code: Select all

history | awk '$2!~/^(\.\/|history)/ { if ($2 != "sudo" || $3 == "-s" || $3 == "-i") cmd[$2]++; else cmd[$3]++; n++; } END { for (s in cmd) { printf("%d %d%% %s ",cmd[s],cmd[s]*100/n,s); for (i=0;i<cmd[s]/12;i++) printf("▄"); printf("\n") } }' | sort -nr | head -n10 | column -t | nl
The fun of 'awk' is as far as I'm concerned mostly the arcania -- although it does in fact sometimes still come in handy.
Last edited by rene on Sat Sep 08, 2018 12:50 pm, edited 3 times in total.

User avatar
AndyMH
Level 5
Level 5
Posts: 611
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Which Linux terminal command do you use the most?

Post by AndyMH » Sat Sep 08, 2018 9:11 am

I am in awe of those that understand awk, and wow, now many pipes in that:

Code: Select all

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
sudo came top of my list followed by man and inxi.
Homebrew i5-8400+GTX1080 Cinnamon 19, Thinkpad T430 i7-3632 Cinnamon 18.3, Thinkpad T420 Cinnamon 18.3, Thinkpad T410 Cinnamon 17.3, Thinkpad T60 19.0 Mate

User avatar
Pepi
Level 5
Level 5
Posts: 700
Joined: Wed Nov 18, 2009 7:47 pm

Re: Which Linux terminal command do you use the most?

Post by Pepi » Sat Sep 08, 2018 9:47 am

help :mrgreen:

User avatar
kc1di
Level 13
Level 13
Posts: 4710
Joined: Mon Sep 08, 2008 8:44 pm
Location: Maine USA

Re: Which Linux terminal command do you use the most?

Post by kc1di » Sat Sep 08, 2018 11:09 am

short list, But then this is only a 1 day old install :)

Code: Select all

s 1	12  52.1739%  sudo
     2	4   17.3913%  cd
     3	3   13.0435%  ls
     4	1   4.34783%  wine
     5	1   4.34783%  sh
     6	1   4.34783%  history
     7	1   4.34783%  find
Easy tips : https://sites.google.com/site/easylinuxtipsproject/
Linux Mint Installation Guide: http://linuxmint-installation-guide.rea ... en/latest/
Registered Linux User #462608

User avatar
kc1di
Level 13
Level 13
Posts: 4710
Joined: Mon Sep 08, 2008 8:44 pm
Location: Maine USA

Re: Which Linux terminal command do you use the most?

Post by kc1di » Sat Sep 08, 2018 11:09 am

short list, But then this is only a 1 day old install :)

Code: Select all

s 1	12  52.1739%  sudo
     2	4   17.3913%  cd
     3	3   13.0435%  ls
     4	1   4.34783%  wine
     5	1   4.34783%  sh
     6	1   4.34783%  history
     7	1   4.34783%  find
Easy tips : https://sites.google.com/site/easylinuxtipsproject/
Linux Mint Installation Guide: http://linuxmint-installation-guide.rea ... en/latest/
Registered Linux User #462608

Post Reply

Return to “Chat about Linux”