1

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?

1
  • 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. :/ Jul 13, 2012 at 16:34

1 Answer 1

8

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
2
  • 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. Jul 9, 2012 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, 2012 at 13:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .