command to show updates to files
Folks, do anybody knows a command like 'less', but that automatically show updates to the content of the file? I want to see 'real time' the change of the content of some file...
I thought that the parameter '-R' (repaint) of 'less' would do this, but I tested and nothing... thanx by the attention folks... [ ]'s |
It depends on what do you mean.
If what you want is to see how contents is being added to a file (for example, to monitorize a log file), you can use tail. for example, in an xterm you could do: Code:
tail -f /var/log/messages |
that`s perfect
thanx pretty much! |
I'm not sure I understand what you mean. If you are talking about a log file that has data appended onto the end of it, then a tail -f would show the data being appended. Otherwise you would probably have to write a script that slept for a period of time then awoke to check the last modified time of file, I haven't tested the following, but something like,
touch /tmp/compare_time do while (1) sleep 30 find /log_dir -name "file_name" -newer /tmp/compare_time if [ $? -eq 0 ] then touch -m /tmp/compare_time less /log_dir/file_name fi done |
Would not the command "watch" do this job?
|
All times are GMT -5. The time now is 12:20 PM. |