netstat和ss在linux之间有什么区别? [英] difference between netstat and ss in linux?

查看:305
本文介绍了netstat和ss在linux之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux中,netstat命令告诉我们系统中活动套接字的信息.

In linux, netstat command tells us information of active sockets in system.

我了解到netstat使用/proc/net/tcp来获取系统网络信息.

I understand that netstat uses /proc/net/tcp to acquire the system network information.

因为netstat手册页说netstat已过时,所以我们应该使用'ss'.

Since netstat man page says that netstat is obsolete, so we should use 'ss'.

NOTE
   This program is obsolete.  Replacement for netstat is ss.   Replacement
   for  netstat -r is ip route.  Replacement for netstat -i is ip -s link.
   Replacement for netstat -g is ip maddr.

我发现ss执行类似的功能,但未使用 /proc/net/tcp获取系统网络信息.

I have discovered that ss performs similar functionality but it does not use /proc/net/tcp to acquire system network information.

现在我很好奇ss如何获取系统网络套接字信息?

Now I am curious how ss gets system network socket information?

推荐答案

它直接使用 Netlink 从内核空间获取它们使用经典的套接字 API.

It gets them from kernel space directly using Netlink which uses the classic sockets API.

这篇关于netstat和ss在linux之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆