Linux查看進程詳細

遇到的問題是想要查看進程的啓動腳本在哪裏,比如自己寫的weblogic啓動腳本,但忘記放在哪裏了,這時候可以用以下方式

 

1、用ps -ef |grep xxxxx 得到該進程的pid

2、輸入ls -l ,結果中 exe鏈接對應的就是可執行文件的路徑
$ ls -l /proc/18283

dr-xr-xr-x 2 root root 0 Jan 21 10:39 attr
-r-------- 1 root root 0 Jan 21 10:39 auxv
-r--r--r-- 1 root root 0 Jan 21 10:14 cmdline
-rw-r--r-- 1 root root 0 Jan 21 10:39 coredump_filter
-r--r--r-- 1 root root 0 Jan 21 10:39 cpuset
lrwxrwxrwx 1 root root 0 Jan 21 10:39 cwd -> /app/script/test
-r-------- 1 root root 0 Jan 21 10:39 environ
lrwxrwxrwx 1 root root 0 Jan 21 10:39 exe -> /bin/bash
dr-x------ 2 root root 0 Jan 21 10:39 fd
-r--r--r-- 1 root root 0 Jan 21 10:39 io
-r-------- 1 root root 0 Jan 21 10:39 limits
-rw-r--r-- 1 root root 0 Jan 21 10:39 loginuid
-r--r--r-- 1 root root 0 Jan 21 10:39 maps
-rw------- 1 root root 0 Jan 21 10:39 mem
-r--r--r-- 1 root root 0 Jan 21 10:39 mounts
-r-------- 1 root root 0 Jan 21 10:39 mountstats
-rw-r--r-- 1 root root 0 Jan 21 10:39 oom_adj
-r--r--r-- 1 root root 0 Jan 21 10:39 oom_score
lrwxrwxrwx 1 root root 0 Jan 21 10:39 root -> /
-r--r--r-- 1 root root 0 Jan 21 10:39 schedstat
-r-------- 1 root root 0 Jan 21 10:39 smaps
-r--r--r-- 1 root root 0 Jan 21 10:14 stat
-r--r--r-- 1 root root 0 Jan 21 10:39 statm
-r--r--r-- 1 root root 0 Jan 21 10:14 status
dr-xr-xr-x 3 root root 0 Jan 21 10:39 task
-r--r--r-- 1 root root 0 Jan 21 10:39 wchan

以下是/proc目錄中進程N的信息

/proc/N pid爲N的進程信息

/proc/N/cmdline 進程啓動命令

/proc/N/cwd 鏈接到進程當前工作目錄

/proc/N/environ 進程環境變量列表

/proc/N/exe 鏈接到進程的執行命令文件

/proc/N/fd 包含進程相關的所有的文件描述符

/proc/N/maps 與進程相關的內存映射信息

/proc/N/mem 指代進程持有的內存,不可讀

/proc/N/root 鏈接到進程的根目錄

/proc/N/stat 進程的狀態

/proc/N/statm 進程使用的內存的狀態

/proc/N/status 進程狀態信息,比stat/statm更具可讀性

 

轉載地址: https://blog.csdn.net/zheng0518/article/details/42964913

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章