The tail -n, –lines=[-]NUM option prints the last NUM lines, instead of the last 10; or use -n +NUM to output starting with line NUM.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
## create a file with 100 lines > myfile; i=1; while [ $i -le 200 ]; \ do echo "$i" >> myfile; ((i++)); done ## default tail myfile ## by default, returns bottom 10 lines ## tail NUM = positive integer tail -n 20 myfile ## returns bottom 20 lines ## tail NUM = negative integer tail -n -20 myfile ## also returns bottom 20 lines rm myfile |