Search code examples
bashstdoutio-redirectionnetcat

how to receive contents of txt file using netcat


I've tried to use this to receive the contents (and echo it), but I get the error of file not found, could anyone help me? Thanks in advance

netcat -l 127.0.0.1 1234 < file.txt

EDIT:

I've got it in a wrong way, problem solved now!


Solution

  • To output to stdout and to file.txt:

    netcat -l 127.0.0.1 1234 | tee file.txt