Most people know head -n 5 for the first five lines. Put a minus in front of the number and GNU head does the opposite: everything except the last five.
head -n -5 report.txt
That is useful for files with a footer you do not want, like a summary block under a table, or a few lines of totals at the end of an export. You do not need to know how many lines the file has.
A quick way to see it work:
seq 10 | head -n -3
That prints 1 to 7.
I’d pair it with its partner in tail. tail -n +2 skips the header at the top, and head -n -1 skips a footer at the bottom, so
tail -n +2 export.csv | head -n -1
leaves only the data rows. The same minus works with bytes: head -c -1 drops the last byte, which removes a trailing newline from a file.
Because it has to hold back the last lines until it knows where the end is, head -n -5 cannot print anything from a stream that never ends, like tail -f. It waits until the input closes. The negative count is also a GNU feature; on macOS and BusyBox you get an error instead, so a portable script would need sed or awk for this.
Further reading: GNU coreutils: head invocation