how to skip line in linux

Output of file

#cat file
test1
test2
test3

Skip last line 

#head -n-1 file
test1
test2

Skip last two line

#head -n-2 file
test1