For systems that are based on Unix operating systems that run on Unix-like operating systems, it is possible to use the “tail“ command is used to read an file and outputs the final part of the file (the “tail”).
Tail commands can be utilized to check open files and data streams. tail command is also able to monitor open and unread files and display the latest information as it’s recorded. It’s, for example, an effective way to keep track of the latest events in the computer record in real-time.
This page is about tail, the GNU/ Linux version of tail..
- Similar commands
- Linux commands help
As a the default setting, the tail prints the last 10 lines of every document in the standard output. If you choose to specify multiple files each output set is preceded by an header that displays the file’s name.
If there is no file defined, or if the there is no file, a die (“-“), tail reads input from the standard input.
Outputs the latest 10 line from myfile.txt, and is monitoring myfile.txt for updates; tail then continues to output any new lines included in myfile.txt.
This is an excellent illustration of how to use the tail along with the grep to monitor the log file in real-time.
This command the tail command monitors the log file access.log. It pipe access.log‘s final 10 lines, along with any additional lines that are added, into the grep utility. grp takes the output from the tail and outputs only the lines that contain that number 18.104.22.168. 22.214.171.124.