Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On the linux CLI: I have a 3 day running scan that I piped to a file (I know, should've rather had it write internally to a file).

Which brings me to my question, say I have a command

long_process_here > output.txt

Is there a way to display or output that information whilst the process is still running? Pipe what's in memory to a screen?

share|improve this question
1  
Might wanna be more specific next time. The listed answer doesn't work on my AS400 command line, any version of Windows CLI I've worked with, or the SSH sessions into my Cisco gear, and I think that trying it on the [CLI] terminal connection on our PBX just crashed the office phone system. :/ –  HopelessN00b Jul 13 '12 at 16:34
add comment

1 Answer

up vote 8 down vote accepted

There is a program named tee that writes input to a file as it outputs it on the screen:

long_process_here | tee output.txt

Now that you've run the program though, you can use tail to "follow" the output file and output new lines as they're added to it:

tail -f output.txt
share|improve this answer
    
Thanks DerfK. I know about tail - for some reason it wouldn't display anything and the text file in questions seemed to stay empty right up until the end of the amazingly endless process. Thanks a million for the tee suggestion. Unsure as to why the output script (which outputs as it runs), didn't write/pipe output to the file as it happened, guessing it was buffered in memory. –  Forkrul Assail Jul 9 '12 at 12:39
2  
@ForkrulAssail it depends on what your amazingly endless process was. For instance, if there was a grep in there, by default grep buffers a bunch of data at a time. –  DerfK Jul 9 '12 at 13:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.