How to get external referals

Referer is one of values in access log records. If you don't have it, try to change Apache log format settings. From Referers you can find out new links to your pages and some interesting sources similar to your content.

Top 50 referals

cat log.txt | cut -d\" -f4 | sort | uniq -c | sort -rn | head -50

From log file we will get all referers. Sort them out and count unique referers. At the end all referers are sort by numbers from biggest and only first 50 items is on the output. If there is only dash (-) in some line, it means it's request without Referer.

Only external pages

In previous list there will be all referers including referers to your website. You can filter them out with this modification:

cat log.txt | cut -d\" -f4 | grep -v "http://yourdomain/" \
| sort | uniq -c | sort -rn | head -50

Only change string yourdomain with your own homepage address.