LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 11-03-2008, 05:27 AM   #1
gustavolinux
Member
 
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
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
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
There are variants like mtail that can use colors and other features.
 
Old 11-03-2008, 05:48 AM   #3
gustavolinux
Member
 
Registered: Aug 2008
Posts: 36

Original Poster
Rep: Reputation: 15
that`s perfect

thanx pretty much!
 
Old 11-03-2008, 05:54 AM   #4
tidww01
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 ]
then
touch -m /tmp/compare_time
less /log_dir/file_name
fi
done
 
Old 11-03-2008, 10:55 AM   #5
john test
Member
 
Registered: Jul 2008
Distribution: ubuntu 9.10
Posts: 527
Blog Entries: 1

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


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:47 PM.

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