System Management

A web server log at /var/log/web/access.log is space-delimited, with the client IP address in the first field. An administrator needs a list of each distinct client IP with its number of requests, ordered from most requests to fewest. Which command pipeline produces this output?

Show the answer

Correct answerB. awk '{print $1}' access.log | sort | uniq -c | sort -rn

Extracting field 1 with awk, sorting so identical IPs are adjacent, counting with uniq -c, and sorting numerically in reverse gives ranked counts. Skipping the first sort is tempting, but uniq only collapses adjacent duplicate lines, so counts would be wrong.