Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Kinda server noob. Is there a simple command to run on server access logs to track downloads of a particular file? Running Ubuntu 10.04.

share|improve this question

$ grep "/path/to/file" /var/log/httpd/access.log | wc -l

That looks for entries in your access log for '/path/to/file' and gives you a count of those lines. Run it against more logs for more days.

share|improve this answer

As Bill Weiss suggested, though older files are compressed, run zgrep on them. You can also use tail to see requested files in real time:

tail -f /var/log/httpd/access.log | grep "/path/to/file"

or to monitor multiple files:

tail -f /var/log/httpd/access.log | grep -E "(/path/to/file|/path/to/other/file)"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.