I am using following linux command to check SMTP port 25
timeout 5 nc -v -u 127.0.0.1 25
which returns this
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to 127.0.0.1:25.
I would save the output in a file but I can not find a way to do that, I tried this
timeout 5 nc -v -u 127.0.0.1 25 > output.txt
and
timeout 5 nc -v -u 127.0.0.1 25 2>&1 > output.txt
but the output.txt file is always empty. How can I save the nc output in a file in this situation ?