Resources hits

You can check how many times a specific page or a resource was requested using AWK:

$ awk '{print $7}' access.log | sort | uniq -c | sort -rn 

The preceding command will sort the requested resources from the highest requested resource to the lowest:

The resources could be images, text files, or CSS files.

If you want to look at the requested PHP files, you can use grep to get PHP files only:

$ awk ' ($7 ~ /php/) {print $7}' access.log | sort | uniq -c | sort -nr  

Alongside each page, there is the number of hits.

You can grab ...

Get Mastering Linux Shell Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.