linux - Tcpdump 命令 - Linux - Unix

标签 linux shell unix ubuntu command

我正在使用 tcpdump 命令捕获网络接口(interface) eth0 上的流量

tcpdump -Xvv -n -i eth0 -c 300 > captureFile.txt

在 shell 中出现下一条消息

tcpdump:监听 eth0,链路类型 EN10MB(以太网),捕获大小 96 字节 捕获 300 个数据包 过滤器收到 302 个数据包 内核丢弃了 0 个数据包

如何在命令行中不显示消息???

最佳答案

在命令行末尾添加2>/dev/null:

tcpdump -Xvv -n -i eth0 -c 300 > captureFile.txt 2>/dev/null

Tcpdump 将消息写入标准错误,并且 > 重定向仅适用于标准输出。

如果您希望消息出现在 captureFile.txt 中,请使用:

tcpdump -Xvv -n -i eth0 -c 300 > captureFile.txt 2>&1

有关重定向的更多信息,请参阅 http://www.tldp.org/LDP/abs/html/io-redirection.html

关于linux - Tcpdump 命令 - Linux - Unix,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14324925/

相关文章:

linux - 根据字典替换文本

javascript - 如何使用 Javascript 和 PHP 从浏览器连接到 WIFI?

linux - 何时不将 -r 与 cp 一起使用?

windows - 为什么 "Executable files"依赖于操作系统?

perl - String::ShellQuote: 我什么时候需要 `shell_quote` ?

shell - 在 ubuntu 的 shell 脚本中调整图像大小

bash - 如何使用 Bash 脚本中的密码运行 sftp 命令?

linux - 并行执行多个 scps 时,为什么 scp 偶尔会失败?

linux - Unix 如何阻止 unix/linux `wall` 消息传递?

c++ - C中的快速生产者/慢速消费者