I am trying to find a Unix command (combination, maybe) on how to continuously display a file of its last several lines of contents. But during this displaying, I want some of the top lines are always displayed on the screen top when the rolling contents reach the screen top.
Is that possible?
job name, John's job on 2013-Jan-30,... Tab1, Tab2, Tab3 0, 1, 2, 1, 90, 89 2, 89, 23 ...
Reference: http://www.unix.com/unix-dummies-questions-answers/172000-head-tail-how-display-middle-lines.html
head -15 /etc/passwd To look at the last few lines of a file, use the tail command. tail works the same way as head: type tail and the filename to see the last 10 lines of that file, or type tail -number filename to see the last number lines of the file. Try using tail to look at the last five lines of your .
Use the tail command to write the file specified by the File parameter to standard output beginning at a specified point. This displays the last 10 lines of the accounts file.
Linux Tail Command Syntax Tail is a command which prints the last few number of lines (10 lines by default) of a certain file, then terminates. Example 1: By default “tail” prints the last 10 lines of a file, then exits. as you can see, this prints the last 10 lines of /var/log/messages.
To display last 20 lines of a file linux use the tail command. Displays the last 20 lines. The default is 10 if you leave out the -n option.
I use this function all the time to monitor a log file in another terminal window.
tail -f <filename>
I recommend taking it a step forward to look for particular text in the log. Great if you are only interested in seeing some particular entry being written to the file.
tail -f <filename> | grep <keyword or pattern>
This will update every 2 seconds rather than whenever data is written to the file, but perhaps that's adequate:
watch 'head -n 2 job.sta; tail job.sta'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With