Reputation: 412
In a bash script I need to run a tcpdump command and save the output to a file however when I do that via > /tmp/test.txt
i still get the following output in the console:
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 1500 bytes
1 packet captured
1 packet received by filter
0 packets dropped by kernel
However I do wnat the script to wait for the command to complete before continuing.
is it possible to supress this output?
Upvotes: 2
Views: 5511
Reputation: 6274
The output you're seeing is written to stderr
, not stdout
, so you can redirect it to /dev/null
if you don't want to see it. For example:
tcpdump -nn -v -i eth0 -s 1500 -c 1 'ether proto 0x88cc' > /tmp/test.txt 2> /dev/null
Upvotes: 4