LinuxAnswers - the LQ Linux tutorial section.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-03-2008, 05:27 AM   #1
Registered: Aug 2008
Posts: 36

Rep: Reputation: 15
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
Old 11-03-2008, 05:37 AM   #2
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,052

Rep: Reputation: 379Reputation: 379Reputation: 379Reputation: 379
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:

tail -f /var/log/messages
There are variants like mtail that can use colors and other features.
Old 11-03-2008, 05:48 AM   #3
Registered: Aug 2008
Posts: 36

Original Poster
Rep: Reputation: 15
that`s perfect

thanx pretty much!
Old 11-03-2008, 05:54 AM   #4
LQ Newbie
Registered: Dec 2005
Posts: 19

Rep: Reputation: 0
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 ]
touch -m /tmp/compare_time
less /log_dir/file_name
Old 11-03-2008, 10:55 AM   #5
john test
Registered: Jul 2008
Distribution: ubuntu 9.10
Posts: 527
Blog Entries: 1

Rep: Reputation: 35
Would not the command "watch" do this job?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
yum command to exclude some updates? gimmee Fedora 8 03-16-2014 03:15 AM
Which linux command or commands to show the same entries of two files ? just.srad Programming 9 04-11-2008 03:47 AM
how to show size of files in FIND command packets Linux - General 5 04-17-2007 10:49 PM
updates to PC1 show up on PC2 Trio3b Linux - Security 1 11-26-2005 03:24 PM
Why does mysqld not show up w/ps command baandar Linux - Software 3 09-01-2004 02:21 AM

All times are GMT -5. The time now is 04:35 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration