Output the last part of files with the tail command
Hosted by Dann on 2012-07-31 is flagged as Explicit and is released under a CC-BY-SA license.
Listen in ogg,
mp3 format. | Comments (0)
Linux In The Shell aims to explore the use of many commands a user can run in the Bash Shell. Tutorials include a write up with examples, an audio component about the write up, and a video component to demonstrate the usage of the command.
The website is http://www.linuxintheshell.com/
The tail command is used to print out the last 10 lines of a file to standard out. This command is a staple in a system administrator’s tool kit and especially handy when monitoring log files. The basic syntax is:
Which will output the last 10 lines of the file. You can alter the number of lines with the -n, or –lines=, flag:
tail -n20 some_file
tail –lines=20 some_file
In some versions of tail you can get away with specifying the number of lines from the end with just a “-” and number:
tail -30 some_file
Instead of working backwards with the -n command you can specify a “+” and some number to start from that number and list the contents to the end:
tail -n+30 some_file
This will display the contents of some_file from line 30 to the end of the file.
For the complete write up including video please go to http://www.linuxintheshell.com/2012/07/31/episode-012-tail/
Subscribe to the comments RSS feed.
Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.
Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).