[tt]
awk 'NR<=500' /path/to/input
[/tt]
Explanation. An awk program consists of optional function definitions and <test> { <action> } pairs. If the test yields true (i.e., non-zero), then the action is performed. Example:
[tt]
/minutes/ { total += $1 }
END { print "Total minutes:", total }
[/tt]
In the first line, a search is made in the line just read for the string "minutes"; if it's found, the result is TRUE and the action "total += $1" is performed (the number in field 1 is added to "total"). In the second line, the special test "END" is true after all of the file has been read.
In PHV's program, the action is missing, so awk assumes that the desired action is "{ print $0 }", i.e., print the line just read. "NR<=500" means "Is the number of the record (or line) just read less than or equal to 500?"
In the program I posted, it is necessary to find out the number of lines in the file before it would be possible to print the last 500 lines. So in the "BEGIN" action section, I take the filename that awk is planning to read and append it to ARGV, so that the filename appears twice and the file will be read twice.