在linux下檢視程序大家都會想到用 ps -ef|grep ***
可是看到的不是全路徑,怎麼看全路徑呢?
每個程序啟動之後在 /proc下面有乙個於pid對應的路徑
例如:ps -ef|grep python
顯示:oracle 4431 4366 0 18:56 pts/2 00:00:00 python server.py
4431就是程序號
到/proc/4431下,ls -l 會看到:
總用量 0
-r--r--r-- 1 oracle oinstall 0 12月 29 18:58 cmdline
lrwxrwxrwx 1 oracle oinstall 0 12月 29 18:58 cwd -> /***/ultserver_aa
-r-------- 1 oracle oinstall 0 12月 29 18:58 environ
lrwxrwxrwx 1 oracle oinstall 0 12月 29 18:58 exe -> /usr/bin/python2.4
dr-x------ 2 oracle oinstall 0 12月 29 18:58 fd
-r-------- 1 oracle oinstall 0 12月 29 18:58 maps
-rw------- 1 oracle oinstall 0 12月 29 18:58 mem
-r--r--r-- 1 oracle oinstall 0 12月 29 18:58 mounts
lrwxrwxrwx 1 oracle oinstall 0 12月 29 18:58 root -> /
-r--r--r-- 1 oracle oinstall 0 12月 29 18:58 stat
-r--r--r-- 1 oracle oinstall 0 12月 29 18:58 statm
-r--r--r-- 1 oracle oinstall 0 12月 29 18:58 status
注意cwd,即是你要查詢的程序所在路徑。
linux 下檢視乙個程序執行路徑的方法
在linux下檢視程序大家都會想到用 ps ef grep 可是看到的不是全路徑,怎麼看全路徑呢?每個程序啟動之後在 proc下面有乙個於pid對應的路徑 例如 ps ef grep python 或者用top檢視,獲得pid 顯示 oracle 4431 4366 0 18 56 pts 2 00...
Linux程序執行空間檢視
在linux下,當乙個服務程式啟動,如何檢視這個服務程序記憶體占用情況?這裡簡單列出以下linux命令是如何檢視的,檢視出來的資訊表示什麼意思 1 首先你要找到你所有檢視程序id,方法很多,這裡介紹本人常用的方法 通過命令ps ef檢視當前系統所有程序資訊,然後找到自己關係的那個程序即可,當系統程序...
程序只執行乙個例項
守護程序往往需要設定使其只執行乙個例項,這裡展示檔案鎖的方式實現 1.使用fcntl 函式設定檔案鎖 include include include include include include include int main else pause return 0 2.使用flock 設定鎖 ...