Top command 1: Shell code time awk '{print $1}' access. log | sort | uniq-c | sort-nr | head-5 78129 192.168.13.166 75165 192.168.12.52 58657 192.168.12.199 54146 192.168.13.183 34310 192.168.13.181 real 0m5. 849 s user 0m5. 566 s sys 0m0. 285 s command 2: Shell code time awk '{a [$1] ++} END {for (I in) {printf ("% d \ t % s \ n", a [I], I)} 'access. log | sort-nr | head-5 78129 192.168.13.166 75165 192.168.12.52 58657 192. 168.12.199 54146 192.168.13.183 34310 192.168.13.181 real 0m0. 626 s user 0m0. 549 s sys 0m0. 080 s and above are two top statistics commands. The comparison results are clear at a glance. Command 1 is convenient and efficient; command 2 is troublesome and efficient. The reason why I thought of comparing these two commands was due to an interview. At that time, my answer was command 2 (I used to use command 2 before that, but I did not use command 1 ). The other party immediately questioned the answer I gave. First, I doubt the correctness of the answer. "Isn't this method correct ?". When I explained that I have used this command in my work, I questioned the efficiency of this command. "There should be more efficient methods !". What I actually want to say is that sometimes the interview may not be able to identify the real problem.