日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

lsof查看进程占用文件_lsof命令查看进程socket相关信息

發布時間:2024/10/12 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 lsof查看进程占用文件_lsof命令查看进程socket相关信息 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.釋義

查看進程打開的文件、目錄,還可以查看進程監聽的端口等socket相關的信息

2.系統幫助

lsof: illegal option character: -

lsof: -e not followed by a file system path: "lp"

lsof 4.87

latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/

latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ

latest man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man

usage: [-?abhKlnNoOPRtUvVX] [+|-c c] [+|-d s] [+D D] [+|-f[gG]] [+|-e s]

[-F [f]] [-g [s]] [-i [i]] [+|-L [l]] [+m [m]] [+|-M] [-o [o]] [-p s]

[+|-r [t]] [-s [p:s]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [--] [names]

Defaults in parentheses; comma-separated set (s) items; dash-separated ranges.

-?|-h list help -a AND selections (OR) -b avoid kernel blocks

-c c cmd c ^c /c/[bix] +c w COMMAND width (9) +d s dir s files

-d s select by FD set +D D dir D tree *SLOW?* +|-e s exempt s *RISKY*

-i select IPv[46] files -K list tasKs (threads) -l list UID numbers

-n no host names -N select NFS files -o list file offset

-O no overhead *RISKY* -P no port names -R list paRent PID

-s list file size -t terse listing -T disable TCP/TPI info

-U select Unix socket -v list version info -V verbose search

+|-w Warnings (+) -X skip TCP&UDP* files -Z Z context [Z]

-- end option scan

+f|-f +filesystem or -file names +|-f[gG] flaGs

-F [f] select fields; -F? for help

+|-L [l] list (+) suppress (-) link counts < l (0 = all; default = 0)

+m [m] use|create mount supplement

+|-M portMap registration (-) -o o o 0t offset digits (8)

-p s exclude(^)|select PIDs -S [t] t second stat timeout (15)

-T qs TCP/TPI Q,St (s) info

-g [s] exclude(^)|select and print process group IDs

-i i select by IPv[46] address: [46][proto][@host|addr][:svc_list|port_list]

+|-r [t[m]] repeat every t seconds (15); + until no files, - forever.

An optional suffix to t is m; m must separate t from and

is an strftime(3) format for the marker line.

-s p:s exclude(^)|select protocol (p = TCP|UDP) states by name(s).

-u s exclude(^)|select login|UID set s

-x [fl] cross over +d|+D File systems or symbolic Links

names select named files or files on named file systems

Anyone can list all files; /dev warnings disabled; kernel ID check disabled.

-a 指示其它選項之間為與的關系

-c 輸出指定進程所打開的文件

-d 列出占用該文件號的進程

+d 輸出目錄及目錄下被打開的文件和目錄(不遞歸)

+D 遞歸輸出及目錄下被打開的文件和目錄

-i 輸出符合條件與網絡相關的文件

-n 不解析主機名

-p 輸出指定 PID 的進程所打開的文件

-P 不解析端口號

-t 只輸出 PID

-u 輸出指定用戶打開的文件

-U 輸出打開的 UNIX domain socket 文件

-h 顯示幫助信息

-v 顯示版本信息

3.示例

3.1.查看端口連接信息

[root@itbkz.com home]#lsof -i :22

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME

sshd 4300 root 3u IPv4 771312 0t0 TCP itbkz.com:ssh->172.20.3.63:62590 (ESTABLISHED)

sshd 4376 root 3u IPv4 772558 0t0 TCP itbkz.com:ssh->172.20.3.63:57989 (ESTABLISHED)

sshd 4395 root 3u IPv4 771330 0t0 TCP itbkz.com:ssh->172.20.3.63:57999 (ESTABLISHED)

sshd 5334 root 3u IPv4 33110 0t0 TCP *:ssh (LISTEN)

sshd 5334 root 4u IPv6 33119 0t0 TCP *:ssh (LISTEN)

sshd 8442 root 3u IPv4 1305231 0t0 TCP itbkz.com:ssh->172.20.3.63:65236 (ESTABLISHED)

IT博客站版權所有丨如未注明 , 均為原創丨本網站采用BY-NC-SA協議進行授權

轉載請注明原文鏈接:lsof命令查看進程socket相關信息

總結

以上是生活随笔為你收集整理的lsof查看进程占用文件_lsof命令查看进程socket相关信息的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。