Couple of remarks here:
- tail defaults to showing the last 10 lines
- tail -n 5, tail -n -5 and tail -5 all do the same: they show the last five lines of the file
- tail -n +5 and tail +5 all do the same: they show all the lines from the fifth (included) till the end of the file
- tail always shows the end of the file starting from a certain definable line/block/byte
I think you got some stuff a little mixed up, especially regarding positive line numbers (you have to explicitely say +5 to start at the fifth line, as opposed to 5 or -5 starting at the fifth line before end), the fact that tails always ouputs the end of the file. To get the first lines of a file, go with the well-named head
That log rotation is pretty neat! Thanks for the tip!
tail -100 filename will show the last 100 lines of filename.
You don’t need the -n.
does no specification default to numbers or bytes? for some reason i was thinking no specification defaulted to bytes.
Couple of remarks here:
- tail defaults to showing the last 10 lines
- tail -n 5, tail -n -5 and tail -5 all do the same: they show the last five lines of the file
- tail -n +5 and tail +5 all do the same: they show all the lines from the fifth (included) till the end of the file
- tail always shows the end of the file starting from a certain definable line/block/byte
I think you got some stuff a little mixed up, especially regarding positive line numbers (you have to explicitely say +5 to start at the fifth line, as opposed to 5 or -5 starting at the fifth line before end), the fact that tails always ouputs the end of the file. To get the first lines of a file, go with the well-named head