LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Need a command... (https://www.linuxquestions.org/questions/linux-newbie-8/need-a-command-137782/)

Cybers19 01-23-2004 08:52 AM

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

Nis 01-23-2004 09:08 AM

To log a process you can do this: 'command >> command.log &'
Then to monitor that log do this: 'tail -f command.log'

Demonbane 01-23-2004 09:08 AM

tail -F

Cybers19 01-24-2004 04:27 AM

Thx

Nis & Demonbane

whansard 01-24-2004 05:14 AM

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.


All times are GMT -5. The time now is 08:44 PM.