LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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, 06: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, 06:37 AM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,049

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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, 06: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, 06: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, 11: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


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 04:15 AM
Which linux command or commands to show the same entries of two files ? just.srad Programming 9 04-11-2008 04:47 AM
how to show size of files in FIND command packets Linux - General 5 04-17-2007 11:49 PM
updates to PC1 show up on PC2 Trio3b Linux - Security 1 11-26-2005 04:24 PM
Why does mysqld not show up w/ps command baandar Linux - Software 3 09-01-2004 03:21 AM


All times are GMT -5. The time now is 04:32 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration