1

I need to basically see the output of a command which are logs that could run into 1000+ lines while at the same time send it to a file. please help.

trial999
  • 123

2 Answers2

4

Use the tee command:

mycommand | tee filename.txt

Will run mycommand saving standard output to filename.txt while also displaying it on the terminal.

nimrodm
  • 156
-1

Instead of trying to duplicate the output (I/O is expensive!), how about writing to the file and opening a separate terminal and using tail -f <file>.log at the same time?

kiminoa
  • 101