How can I write the output of tshark -D to a file?
I user this command from ssh console :
# tshark -D
and get correct result:
1. eth0
2. nflog
3. nfqueue
4. usbmon1
5. any
6. lo (Loopback)
How can I save this output in file ? I tried this :
tshark -D > file.txt
but file.txt has been created empty. where is my error ?
UPD I also tried so :
tshark -D -w file.txt
but in this case file.txt even not been created.
What does
tshark --version
print?At least with Wireshark 2.6.5rc0-53-g80265eff, running on UN*X (macOS, but it should be the same on all UN*Xes, including Linux),
tshark -D >/tmp/stdout
puts the list of devices into/tmp/stdout
. Perhaps you're running an older version and perhaps that version wrote the output of-D
to the standard error.-w
is only used when you're capturing traffic or reading a capture file and writing the packets in that file to another file; it does not work, for example, when you're listing interfaces with-D
.When capturing traffic,
-w
causes a binary packet capture, with raw packet data, to be written to the file; redirecting the standard output causes the text output of dissected packets to be written to the file, so-w
isn't a replacement for redirecting the standard output.