netstat

linux查看端口号占用

丶灬走出姿态 提交于 2019-11-28 19:01:38
1、lsof -i:端口号 2、netstat -tunlp|grep 端口号 都可以查看指定端口被哪个进程占用的情况 【步骤一】lsof -i lsof -i 用以显示符合条件的进程情况,lsof(list open files)是一个列出当前系统打开文件的工具。 以root用户来执行lsof -i命令 ,如下图 【步骤二】lsof -i:端口号 lsof -i:端口号,用于查看某一端口的占用情况,比如查看22号端口使用情况,lsof -i:22,如下图 【步骤三】netstat -tunlp netstat -tunlp用于显示tcp,udp的端口和进程等相关情况,如下图 【步骤四】netstat -tunlp|grep 端口号 netstat -tunlp|grep 端口号,用于查看指定端口号的进程情况,如查看22端口的情况,netstat -tunlp|grep 22,如下图 来源: https://www.cnblogs.com/accpguoliang/p/11421633.html

Starting apache fails (could not bind to address 0.0.0.0:80)

China☆狼群 提交于 2019-11-28 15:21:16
Update: Already fixed, it seems that one of VirtualHosts configurations files was wrong in sites-enabled. I have Ubuntu 11.10 When I run the command to start apache2: sudo /etc/init.d/apache2 start I get the following error message: Starting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs Action 'start' failed. I run this command in order to get the process that is using

How to get default gateway in Mac OSX

非 Y 不嫁゛ 提交于 2019-11-28 15:09:32
I need to retrieve the default gateway on a Mac machine. I know that in Linux route -n will give an output from which I can easily retrieve this information. However this is not working in Mac OSX(Snow Leopard). I also tried netstat -nr | grep 'default' , but I was hoping for a cleaner output like that produced by route -n in Linux/Unix. netstat -nr lists all the interfaces and the default gateway for them. Any kind of suggestion or a hint in the right direction will be appreciated. You can try with: route -n get default It is not the same as GNU/Linux's route -n (or even ip route show ) but

How do I find which application is using up my port? [closed]

倾然丶 夕夏残阳落幕 提交于 2019-11-28 15:02:34
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 8 years ago . I am unable to start GlassFish, because it keeps showing this error message: SEVERE: Shutting down v3 due to startup exception : No free port within range: 8080=com.sun.enterprise.v3.services.impl.monitor.MonitorableSelectorHandler@ed7d1 How can I find what applications are using what ports on Windows Vista? I

2、与网络相关的命令 netstat , tcpdump 等。

早过忘川 提交于 2019-11-28 11:47:59
Netstat 命令 用于显示各种网络相关信息,如网络连接,路由表,接口状态 (Interface Statistics),masquerade 连接,多播成员 (Multicast Memberships) 等等。 参数: -a (all)显示所有选项,默认不显示LISTEN相关 -t (tcp)仅显示tcp相关选项 -u (udp)仅显示udp相关选项 -n 拒绝显示别名,能显示数字的全部转化成数字。 -l 仅列出有在 Listen (监听) 的服務状态 -p 显示建立相关链接的程序名 -r 显示路由信息,路由表 -e 显示扩展信息,例如uid等 -s 按各个协议进行统计 -c 每隔一个固定时间,执行该netstat命令。 tcpdump使用 tcpdump -s 0 -l -w - dst host 10.6.2.110 and port 80 | strings 查看指向目标主机及端口的数据包 tcpdump -s 0 -l -w - dst host 10.6.2.110 and port 80 > file 同上,保存结果到file文件 tcpdump host 10.6.2.110 and \(10.6.2.245 or 10.6.2.11 \) and port 80 截获主机10.6.2.110 和主机10.6.2.11或10.6.2.245的通信 tcpdump

二十、网络ifconfig 、ip 、netstat、ss之二

你说的曾经没有我的故事 提交于 2019-11-28 10:29:37
ip 网络层协议 ip地址 点分十进制分为4段,范围 0-255 ip分类 A 占据1段, 最左侧一段第一位固定为0 0 000 0000 - 0 111 1111 0 - 127 :其中0为网络,127 本地主机内部通信。    网络数: 2^7-2=126个    每个网络中的主机数: 2^24-2=16777216 (1677736)    默认子网掩码: 255.0.0.0    私网地址: 10.0.0.0/8 (8:网络段全为1,有8位) B 占据2段, 最左侧一段第一位固定为10    10 00 0000 - 10 11 1111    128 - 191    网络数:2^(6+8)=2^14=16384个   每个网络中的主机数: 2^16-2=65534   默认子网掩码:255.255.0.0    私网地址: 172.16.0.0/16 - 172.31.0.0/16 (网络变化位第2位) C 占据3段, 最左侧一段第一位固定为110 110 0 0000 - 110 1 1111 192 - 223 网络数:2^(5+8+8)=2^21=2097152个 每个网络中的主机数: 2^8-2=62 默认子网掩码:255.255.255.0 私网地址: 192.168.0.0/24 - 192.168.255.0/24 (网络变化位第3位) D 占据4段,

Process started from system command in C inherits parent fd's

馋奶兔 提交于 2019-11-28 09:14:19
I have a sample application of a SIP server listening on both tcp and udp ports 5060. At some point in the code, I do a system("pppd file /etc/ppp/myoptions &"); After this if I do a netstat -apn, It shows me that ports 5060 are also opened for pppd! Is there any method to avoid this? Is this standard behaviour of the system function in Linux? Thanks, Elison Yes, by default whenever you fork a process (which system does), the child inherits all the parent's file descriptors. If the child doesn't need those descriptors, it SHOULD close them. The way to do this with system (or any other method

Get foreign address name using NETSTAT for established active TCP connections

眉间皱痕 提交于 2019-11-28 06:18:42
问题 I'm using NETSTAT command in PowerShell. I need to grab the list of foreign addresses which starts with XYZ name and are ESTABLISHED as state using TCP connections. I stuck up at parsing because of the NETSTAT result as below. PS C:\Windows\system32> .\NETSTAT.EXE Active Connections Proto Local Address Foreign Address State TCP 10.125.4.233:2310 157.05.39.133:2492 ESTABLISHED I need the foreign address names not the remote address on the local host only. Remote address doesn't show the FQDN.

How to check if a network port is open on linux?

不羁的心 提交于 2019-11-28 03:15:05
How can I know if a certain port is open/closed on linux ubuntu, not a remote system, using python? How can I list these open ports in python? Netstat: Is there a way to integrate netstat output with python? mrjandro You can using the socket module to simply check if a port is open or not. It would look something like this. import socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) result = sock.connect_ex(('127.0.0.1',80)) if result == 0: print "Port is open" else: print "Port is not open" sock.close() If you want to use this in a more general context, you should make sure, that