如何知道某個埠被哪個程序和應用程式占用

2021-05-24 07:54:14 字數 1056 閱讀 9608

第一種方案:

1 使用下面shell script,先建立乙個port.sh檔案:

# more /tmp/port.sh

#!/bin/sh

for pid in `ls /proc`

dopf=`/usr/bin/pfiles $pid 2>/dev/null`

if echo $pf | grep $1 > /dev/null 2>&1

then

echo $pid

/usr/bin/pargs $pid

fidone

2 執行port.sh, 傳入埠號,比如53250 :

#  /tmp/port.sh 53250

3 執行結果如下:

1225

1225:   /usr/lib/thunderbird/thunderbird-bin -uilocale zh-cn

-contentlocale cn

argv[0]: /usr/lib/thunderbird/thunderbird-bin

argv[1]: -uilocale

argv[2]: zh-cn

argv[3]: -contentlocale

argv[4]: cn

4212

4212:   /bin/sh /tmp/port.sh 53250

argv[0]: /bin/sh

argv[1]: /tmp/port.sh

argv[2]: 53250

第三種方案:

使用mdb

from socket info (netstat output), you can know its vnode

from vnode info, you can know which process owns it

from process info, you can know its args, so comes the result.

AIX檢視某個埠被哪個程序占用

問題描述 在系統管理過程中經常遇到的情況就是在啟動某個程序時,會提示埠被占用。如啟動websphere管理控制台時經常碰到9090埠被占用。用 netstat an grep 9090 可以看到該埠正被監聽,但卻不知道是哪個程序占用了該埠,當然也可以改變埠但比較麻煩。如果能找到是哪個程序占用了該埠,...

AIX檢視某個埠被哪個程序占用

問題描述 在系統管理過程中經常遇到的情況就是在啟動某個程序時,會提示埠被占用。如啟動websphere管理控制台時經常碰到9090埠被占用。用 netstat an grep 9090 可以看到該埠正被監聽,但卻不知道是哪個程序占用了該埠,當然也可以改變埠但比較麻煩。如果能找到是哪個程序占用了該埠,...

linux如何檢視埠被哪個程序占用?

1 lsof i 埠號 2 netstat tunlp grep 埠號 都可以檢視指定埠被哪個程序占用的情況 步驟一 lsof i lsof i 用以顯示符合條件的程序情況,lsof list open files 是乙個列出當前系統開啟檔案的工具。以root使用者來執行lsof i命令,如下圖 步...