- Forums
- Linux Hosting
- How To Display Show Get Last 10 Lines From A File In Linux Shell Command
This Page Contains information about How To Display Show Get Last 10 Lines From A File In Linux Shell Command By wallpaperama in category Linux Hosting with 4 Replies. [418], Last Updated: Sat May 18, 2024
wallpaperama
Fri Mar 02, 2007
4 Comments
11934 Visits
i had a very large file in my linux dedicated server i leased from www.webune.com and i wanted to see what were the last list, it was an error log file and it was huge, but opening would mean i would have to wait a while just to see the last lines. well, linux being such a wonderful operating system, it has the tail command so to see the last 10 lines on my error log file all i had to do is send this command in the linux shell and it would get and show me the last ten lines:
CODE:
tail error_log.txt
hey wait a minute, what about if you wanted to display the last 15 lines?
well you can do that with tail: this is how you would display them:
CODE:
tail -15 error_log.txt
you can change 15 to whatever number of lines you want
This displays any new lines added to the file, so is brilliant for watching what is happening in a log
e.g.
tail -f /var/log/apache2/error.log
Hope this helps someone