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

I've got a log file that's managed to bloat upto 150MB. Is there a way to read only the last say 100 lines of the file instead of the whole thing? I don't want to have to download a 150 MB file with my current connection. I'd rather SSH in and read the relevant parts.

share|improve this question
up vote 4 down vote accepted

tail [filename]

share|improve this answer

To expand on Farseeker's answer: tail -n 100 [filename] to get the last 100 lines.

share|improve this answer
Or: tail -100 foo – Xepoch May 20 '10 at 6:39
the -f option shows the last five, and then each new line as it comes in. You can also do things like -100f for the last 100 lines, then follow, and you can grep the output, just put "| grep ERROR" after any of these, and you will only see lines with ERROR in them – Ronald Pottol May 20 '10 at 14:58

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.