sed '$d' file.txt

Category: Text Processing

sed '$d' file.txt

Delete the last line of a file

Removes the last line. $ in sed means 'the last line'.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.