LinuxQuestions.org
Visit Jeremy's Blog.
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 01-23-2004, 08:52 AM   #1
Cybers19
Member
 
Registered: May 2003
Location: Germany - Zöbingen
Distribution: Suse 9.3 & Win XP SP2
Posts: 69

Rep: Reputation: 15
Question Need a command...


Hi everybody!


Can someone tell me how it is possible to get a textfile printed on the screen and if a new entry will be added the output will be automaticly be updated with the last line.

i.e.
File test1.txt:

Line1 -> Hello
Line2 -> bla, bla, bla...

--> Print file (Line1/2) on screen...
A Program added Line 3

As soon as the program added the Line the command should also print the added line to the konsole.


I need this for monitoring.


THX
 
Old 01-23-2004, 09:08 AM   #2
Nis
Member
 
Registered: Jul 2003
Location: Virginia
Distribution: Ubuntu Hoary (5.04)
Posts: 550

Rep: Reputation: 31
To log a process you can do this: 'command >> command.log &'
Then to monitor that log do this: 'tail -f command.log'
 
Old 01-23-2004, 09:08 AM   #3
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
tail -F
 
Old 01-24-2004, 04:27 AM   #4
Cybers19
Member
 
Registered: May 2003
Location: Germany - Zöbingen
Distribution: Suse 9.3 & Win XP SP2
Posts: 69

Original Poster
Rep: Reputation: 15
Thx

Nis & Demonbane
 
Old 01-24-2004, 05:14 AM   #5
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Rep: Reputation: 65
more explanation just for fun.

the -f option means follow, and keeps tail open, and keeps doing tail when the file changes. the >> option means to append to a file instead of overwriting it.a single > would overwrite the file each time instead. the & at the end of the line means give me back the prompt and do this in the background. you can bring it back to the foreground with fg and then kill or suspend the process with control-c or control-z. if you control-z, you can run fg and the process will resume in the foreground, or you can run bg and it will resume in the background.
 
  


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
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 07:19 PM
Require Linux/Perl equivalent command for windows Command alix123 Programming 7 08-19-2005 02:23 AM
Key stroke/command to shut down x and go into the command prompt screen? Fear58 Linux - General 1 07-14-2004 07:14 PM
Command to display whole filestructure hierarchy f/ command line? mjewell Linux - Newbie 10 01-19-2004 10:48 AM
Where is Command line utility for Cups and command tutorial mossy Linux - Software 8 01-16-2004 12:24 AM

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

All times are GMT -5. The time now is 10:04 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