後台nohup開了好多應用,有的應用對應哪個埠,如何在一堆應用裡找到對應埠
通過名稱拿到程序id
ps
-ef | grep name
通過id拿到程序埠
netstat -anp | grep id_num
以查詢jupyter notebook應用埠為例
(base) root@ai-poweredge-r740:~# ps -ef | grep jupyter
root 308805 2980452 0 11:59 pts/1 00:00:00 grep --color=auto jupyter
root 2788946 2737462 0 09:48 pts/3 00:00:02 /opt/anaconda3/envs/study_pytorch_tensorflow/bin/python /opt/anaconda3/envs/study_pytorch_tensorflow/bin/jupyter-notebook pytorch_introduction.ipynb
root 2794770 2788946 0 09:53 ? 00:00:03 /opt/anaconda3/envs/study_pytorch_tensorflow/bin/python -m ipykernel_launcher -f /root/
.local/share/jupyter/runtime/kernel-f6bb6d6a-66ad-4db1-b930-a7cacb2047fc.json
(base) root@ai-poweredge-r740:~# netstat -anp | grep 2788946
tcp 0 0 0.0.0.0:8889 0.0.0.0:* listen 2788946/python
tcp 0 0 127.0.0.1:53582 127.0.0.1:39643 established 2788946/python
tcp 0 0 127.0.0.1:53572 127.0.0.1:39643 established 2788946/python
tcp 0 0 127.0.0.1:42798 127.0.0.1:45871 established 2788946/python
tcp 0 0 127.0.0.1:42794 127.0.0.1:45871 established 2788946/python
tcp 0 0 127.0.0.1:46318 127.0.0.1:43725 established 2788946/python
tcp 0 0 127.0.0.1:41308 127.0.0.1:36921 established 2788946/python
tcp6 0 0 :::8889 :::* listen 2788946/python
unix 3 [
] stream connected 36397405 2788946/python
unix 3 [
] stream connected 36397406 2788946/python
最終根據下面這條訊息找到jupyter notebook 服務開的埠是8889。
tcp 0 0 0.0.0.0:8889 0.0.0.0:* listen 2788946/python
linux程序查埠,埠查程序
ps ef grep 服務name 例如,結果 root 15034 其中,15034就是它的程序pid,如果要刪掉這個程序 kill 9 15034 也可以這樣殺程序 pkill 服務名 根據程序,可以查出它暴露埠 netstat tunlp grep 程序pid 通過程序pid.查服務 ps e...
通過程序ID獲取基位址
下面 是通過程序id來獲取程序的基位址,建立乙個程序快照後,讀取程序模組,一般情況下第乙個模組就是程序的基位址,下面的程式通過模組的字串匹配來找到基位址。通過moduleentry32來讀取,下面是 include include include hmodule fngetprocessbase d...
通過程序ID獲取基位址
下面 是通過程序id來獲取程序的基位址,建立乙個程序快照後,讀取程序模組,一般情況下第乙個模組就是程序的基位址,下面的程式通過模組的字串匹配來找到基位址。通過moduleentry32來讀取,下面是 include include include hmodule fngetprocessbase d...