head exclude last line code example Example: head exclude last line head -n -1 file.txt #Use negative numbers after flag for last lines