ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am trying to shell comands and I tried tail -f and it does not work. Here is what I did
create a file called new
start a new session run tail -f new
go back to old session and echo new_line >> new
return to tail session to see if it prints out the addition to the file called new.
It just sits and runs. I even tried tail -f -s 1 new and it does not seem to make any difference
feel free to do anyway but mine. :)
{edit}
'man tail' 'man bash'...
The reason it hang's is because the file is less than 10 line's, which is why i specified 'tail -n 1', if it is less then 10 line's it will hang.
dunno if it helps or not but are you in the same directory with both files? (ie are you watching /home/foo/new in one and /tmp/new in another window?)
try it with full pathnames...
example:
touch /tmp/junk
tail -f /tmp/junk
in window two copy and paste this:
date >> /tmp/junk
sleep 5
date >> /tmp/junk
sleep 5
date >> /tmp/junk
sleep 5
date >> /tmp/junk
sleep 5
Last edited by Blinker_Fluid; 08-25-2003 at 11:29 AM.
It work's with mine too...i think the problem he still has is it sitting and looping, in that case you would have to send a EOF (end of file), i don't know what that would be, i just used Ctrl-c. Where are you dcoder, tell if this helped at all.
Hi everyone,
Thanks this helps. tail -fn 1 new.txt works and you are right my file had less than 10 lines in it. I was at work today (school) and I tried it on the debian box and it worked just fine there without the n switch.
again thanks for the help :-)
Originally posted by dcoder
Hi everyone,
Thanks this helps. tail -fn 1 new.txt works and you are right my file had less than 10 lines in it. I was at work today (school) and I tried it on the debian box and it worked just fine there without the n switch.
again thanks for the help :-)
Then the file must have been bigger than 10 line's, hmmmm, can you show me the command you used on that box, the one at work that is.
see post #7, i think this is what you wanted, if not oh we'll, 3 hour's of fun to figure it out, and i learned from it too. :)
Hey, I thought this was dead.... thanks for keeping it up :-)
Here is what I just did.
-1 Started a new session and telnet'd into school
-2 Created a file called test.txt and typed in six lines like so
one
two
three
four....
-3 Started a second session and telnet's into school and typed the command tail -f text.txt
-4 Went back to the first session and typed echo seven >> text.txt.
Noticed in the second session that the word seven appeared.
The reason I have interest in this is that students are not allowed to use msn at school so if I tail squid.log and pipe it to grep to look for msn hmmm....;-)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.