lsof `which httpd` #那個進程在使用apache的可執(zhí)行文件
lsof abc.txt 顯示開啟文件abc.txt的進程
lsof -i :22 知道22端口現(xiàn)在運行什么程序
lsof -c abc 顯示abc進程現(xiàn)在打開的文件
lsof -g gid 顯示歸屬gid的進程情況
lsof d /usr/local/ 顯示目錄下被進程開啟的文件
lsof D /usr/local/ 同上,但是會搜索目錄下的目錄,時間較長
lsof -d 4 顯示使用fd為4的進程
lsof -i 用以顯示符合條件的進程情況
語法: lsof -i[46] [protocol][@hostname|hostaddr][:service|port]
46 –> IPv4 or IPv6
protocol –> TCP or UDP
hostname –> Internet host name
hostaddr –> IPv4位置
service –> /etc/service中的 service name (可以不只一個)
port –> 端口號 (可以不只一個)
例子: TCP:25 – TCP and port 25
@1.2.3.4 – Internet IPv4 host address 1.2.3.4
tcp@ohaha.ks.edu.tw:ftp – TCP protocol hosthaha.ks.edu.tw service name:ftp
lsof -n 不將IP轉(zhuǎn)換為hostname,缺省是不加上-n參數(shù)
例子: lsof -i tcp@ohaha.ks.edu.tw:ftp -n
lsof -p 12 看進程號為12的進程打開了哪些文件
lsof |-r [t] 控制lsof不斷重復執(zhí)行,缺省是15s刷新
-r,lsof會永遠不斷的執(zhí)行,直到收到中斷信號
r,lsof會一直執(zhí)行,直到?jīng)]有檔案被顯示
例子:不斷查看目前ftp連接的情況:lsof -i tcp@ohaha.ks.edu.tw:ftp -r
lsof -s 列出打開文件的大小,如果沒有大小,則留下空白
lsof -u username 以UID,列出打開的文件
更多關(guān)于云服務(wù)器,域名注冊,虛擬主機的問題,請訪問西部數(shù)碼官網(wǎng):m.ps-sw.cn