linux檢視指定程式是否執行及關閉

2021-07-02 01:01:21 字數 1126 閱讀 2064

比如程序名叫aaa,可以執行如下命令:ps -ef|grep aaa,如果有內容說明活著

introps -ef|grep daytimetcpsrv

501   859   785   0 12:36下午 ??         0:00.00 ./daytimetcpsrv

501  1252   262   0  3:35下午 ttys001    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=.cvs --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svndaytimetcpsrv

2.結束程序 kill  pid

introkill 859

introps -ef|grep daytimetcpsrv

501  1304   262   0  3:41下午 ttys001    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=.cvs --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svndaytimetcpsrv

introkill 1304                

kill: kill 1304 failed: no such process

如果你知道程序占用的埠號,比如7777,可以執行:netstat -anp | grep 7777,檢查有沒有程式占用該埠,若有的話,看pid或pname是否是你想要找的

如果想要找的是某個服務,比如nfs、smb等,可以用service nfs status檢視

判斷程式是否執行

unit urunexefile inte ce uses windows,messages,sysutils,classes,graphics,controls,forms,dialogs,stdctrls,tlhelp32 type tform1 class tform button2 tbut...

linux指定執行級別

執行級別說明 0 關機 1 單使用者 找回丟失密碼 2 多使用者狀態沒有網路服務 3 多使用者狀態有網路服務 4 系統未使用保留給使用者 5 圖形介面 6 系統重啟 常用執行級別是 3 和 5 要修改預設的執行級別 可改系統的執行級別的配置檔案 etc inittab 的 id 5 initdefa...

如何檢視程序是否在執行

請問大家,如何用c實現 檢視某個程式是否在執行。給點思路 謝謝 author gotop167 posted 2005 02 23 17 16 length 95 byte s original print top 兩個辦法 1.看ps 得到你想要的 2.寫個模組,從程序pcb中比較檔名即可知道!o...