freebsd 中查看打开的端口与对应的进程之间的关联

在freebsd中可以使用sockstat查看打开的socket的情况,包含了端口相应进程的进程名、PID,用户等!

 系统说明:

NAME
     sockstat -- list open sockets

SYNOPSIS
     sockstat [-46clu] [-p ports]

DESCRIPTION
     The sockstat command lists open Internet or UNIX domain sockets.

     The following options are available:

     -4          Show AF_INET (IPv4) sockets.

     -6          Show AF_INET6 (IPv6) sockets.

     -c          Show connected sockets.

     -l          Show listening sockets.

     -p ports    Only show Internet sockets if either the local or foreign
                 port number is on the specified list.  The ports argument is
                 a comma-separated list of port numbers and ranges specified
                 as first and last port separated by a dash.

     -u          Show AF_LOCAL (UNIX) sockets.

     If neither -4, -6 or -u is specified, sockstat will list sockets in all
     three domains.

     If neither -c or -l is specified, sockstat will list both listening and
     connected sockets.

     The information listed for each socket is:

     USER             The user who owns the socket.

     COMMAND          The command which holds the socket.

     PID              The process ID of the command which holds the socket.

     FD               The file descriptor number of the socket.

     PROTO            The transport protocol associated with the socket for
                      Internet sockets, or the type of socket (stream or data-
                      gram) for UNIX sockets.

     LOCAL ADDRESS    For Internet sockets, this is the address the local end
                      of the socket is bound to (see getsockname(2)).  For
                      bound UNIX sockets, it is the socket's filename.  For
                      other UNIX sockets, it is a right arrow followed by the
                      endpoint's filename, or ``??'' if the endpoint could not
                      be determined.

     FOREIGN ADDRESS  (Internet sockets only) The address the foreign end of
                      the socket is bound to (see getpeername(2)).

     Note that TCP sockets in the AF_INET or AF_INET6 domains that are not in
     one of the LISTEN, SYN_SENT, or ESTABLISHED states may not be shown by
     sockstat; use netstat(1) to examine them instead.

SEE ALSO
     fstat(1), netstat(1), inet(4), inet6(4)

HISTORY
     The sockstat command appeared in FreeBSD 3.1.

AUTHORS
     The sockstat command and this manual page were written by Dag-Erling
     Smorgrav <des@FreeBSD.org>.

FreeBSD 5.4                    September 7, 2004                   FreeBSD 5.4

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
第1章 引言 FreeBSD的起源 Unix的历史发展 FreeBSD的起源和发展 当前FreeBSD的版本 FreeBSD的功能特点 FreeBSD的特点和应用范围 使用FreeBSD的实例 其他相关系统和组织 GNU’s Not Unix GNU/Linux 其他BSD系统 FreeBSD的相关资源 联机文档 出版物 Internet资源 商业服务和支持 第2章 安装与配置 安装之前的准备 硬件设备 安装介质 准备硬盘和软盘 安装FreeBSD 启动安装程序 安装系统 基本系统配置 设置网络 其他安装问题 第3章 系统管理和维护 系统的启动与关闭 系统启动过程 系统启动脚本 系统登录与退出 关闭系统 用户管理 增加用户 超级用户root 登录类别 shell设置 文件系统与磁盘操作 文件的属性 设备文件 安装文件系统 软盘操作 维护文件系统 检查硬盘 调整文件系统的目录结构 建立文件系统 管理交换设备 调整系统设置 调整控制台设置 配置系统时间 进程管理 查看系统状态 定时执行程序 进程的权限 安装应用软件 应用软件的类别 Packages Collection 打印机配置 系统结构 配置打印机 系统日志与备份 系统日志 系统备份 第4章 网络配置与使用 DOD参考模型 基本网络设置 手工配置网络 拨号网络 串口和modem PPP协议 DNS服务 DNS的体系结构 配置缓冲或转发方式的named 定义自己的名字服务 电子邮件 邮件服务器 在FreeBSD查看邮件 网络文件系统(NFS) NFS客户支持 NFS服务器 第5章 设置和使用X Window 安装和设置X服务器 X Free86的硬件要求 安装XFree86 使用XF86Setup配置X服务器 使用xf86config配置X服务器 使用和配置X Window X Window的基本概念 进入X Window 定制X Window的基本方法 X Window下的文环境 文X应用软件 外挂式文显示与输入软件 文X服务器 配置文件XF86Config 第6章 定制应用软件与系统内核 编译应用软件 Ports Collection 手工编译安装程序 可执行程序格式 配置FreeBSD内核 为编译内核准备源代码 编译安装新内核 缺省内核配置选项 其他内核设置选项 升级系统 第7章 与Windows系统集成 集成Unix和Windows的方式 NetBIOS与SMB/CIFS协议 NetBIOS名字解析 SMB/CIFS协议 配置和使用Samba 安装samba 配置samba 根据Windows网络设置Samba 访问Windows系统资源 使用smbclient访问Windows资源 使用SharityLight安装SMB文件系统 设置DHCP DHCP的工作过程 设置和使用DHCP 第8章 系统与网络安全 网络安全概念 认证与加密 安全问题 防火墙技术 增强安全设置 设置基本系统 安全工具 设置防火墙功能 设置和使用ipfw/natd 设置和使用ipfilter 构建防火墙 第9章 设置WWW服务 基本概念 超文本传输协议HTTP 数据处理方式 安装和设置Apache 基本安装 配置Apache服务器 服务器的安全控制 对IP地址和域名的控制 基于用户的访问控制 安全连接方式SSL CGI和SSI的安全性 调整服务器性能 单服务器性能调整 提升静态网页服务能力的综合方式 负载均衡技术 基于DNS的负载均衡 反向代理负载均衡 基于NAT的负载均衡技术
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值