You can use tail command to display the bottom N lines of a file or pipe in Linux.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
## create a file with 100 lines > myfile; i=1; while [ $i -le 100 ]; \ do echo "$i" >> myfile; ((i++)); done ## create some additional files cp myfile myfile1 cp myfile myfile2 ## default tail myfile ## by default, returns bottom 10 lines ## multiple files also supported tail myfile myfile1 myfile2 ## returns bottom 10 lines of each ## files along with filename as header ## bottom N lines (-n tail -n 20 myfile ## returns bottom 20 lines ## with pipe ps -ax | tail ## also works with pipe rm myfile |