首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Ubuntu命令行启动wireshark时出现错误"cannot open display“

在Ubuntu命令行启动wireshark时出现错误"cannot open display“
EN

Stack Overflow用户
提问于 2012-12-04 14:39:32
回答 2查看 37.8K关注 0票数 11

我在Ubuntu上安装了wireshark,当我运行它时:

代码语言:javascript
复制
/usr/bin/wireshark

我得到一个错误:

代码语言:javascript
复制
(wireshark:27945): Gtk-WARNING **: cannot open display:

我想在命令提示符下运行wireshark。

我不想使用UI。我不知道为什么它会抱怨显示器,我想在一个端口上运行它。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-12-04 14:51:59

你可以试试wireshark tshark,它是wireshark项目的一部分,是一个基于控制台的wireshark。

您应该阅读read man tshark

例如,要在80端口上捕获http数据包,请运行:

代码语言:javascript
复制
tshark -f 'tcp port 80 and http'

附注:示例已修复为使用捕获筛选器而不是显示筛选器。

票数 16
EN

Stack Overflow用户

发布于 2012-12-04 14:48:03

在Ubuntu上,运行wireshark会抱怨显示:

代码语言:javascript
复制
el@apollo:~$ wireshark
(wireshark:20619): Gtk-WARNING **: cannot open display:

设置DISPLAY环境变量:

代码语言:javascript
复制
export DISPLAY=:0.0
/usr/bin/wireshark

然后它就能工作了:

代码语言:javascript
复制
el@apollo:~$ wireshark -Y
wireshark: option requires an argument -- 'Y'

Usage: wireshark [options] ... [ <infile> ]

Capture interface:
  -i <interface>           name or idx of interface (def: first non-loopback)
  -f <capture filter>      packet filter in libpcap filter syntax
  -s <snaplen>             packet snapshot length (def: 65535)
  -p                       don't capture in promiscuous mode
  -k                       start capturing immediately (def: do nothing)
  -S                       update packet display when new packets are captured
  -l                       turn on automatic scrolling while -S is in use
  -I                       capture in monitor mode, if available
  -B <buffer size>         size of kernel buffer (def: 2MB)
  -y <link type>           link layer type (def: first appropriate)
  -D                       print list of interfaces and exit
  -L                       print list of link-layer types of iface and exit

wireshark是一个X应用程序,因此它需要知道将X11显示输出发送到何处。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13697397

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档