檢視程式:ps -le | more ,ps -aux | more ,ps
& 後臺執行 jobs 檢視後臺程式 fg [n]調到前臺 bg放到後臺 ctrl +c 終止 ctrl +z 放到後臺 檢視關鍵字的程式:ps -le | grep [關鍵字]
[root@meng ~]# /etc/rc.d/init.d/httpd status httpd 已停
[root@meng ~]# /etc/rc.d/init.d/httpd start 正在啟動
httpd:httpd: apr_sockaddr_info_get() failed for meng.com
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName [確定]
[root@meng ~]# ps -le | grep httpd
1 R 0 31463 1 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31466 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31467 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31468 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31469 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31470 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31471 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31472 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31473 31463 0 80 0 - 2941 - ? 00:00:00 httpd
殺死程式 kill
kill 程式號
[root@meng ~]# ps -le | grep httpd 1 S 0 31463 1 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31466 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31467 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31468 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31469 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31470 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31471 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31472 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31473 31463 0 80 0 - 2941 - ? 00:00:00 httpd
[root@meng ~]# kill 31466 [root@meng ~]# ps -le | grep httpd
1 S 0 31463 1 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31467 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31468 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31469 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31470 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31471 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31472 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31473 31463 0 80 0 - 2941 - ? 00:00:00 httpd
[root@meng ~]# kill 31467 [root@meng ~]# ps -le | grep httpd
1 S 0 31463 1 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31468 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31469 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31470 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31471 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31472 31463 0 80 0 - 2941 - ? 00:00:00 httpd
5 S 48 31473 31463 0 80 0 - 2941 - ? 00:00:00 httpd
kill -s 訊號 程式號 kill -l 列出所有的訊號
killall httpd 所有的httpd的服務程式都將殺死
#xkill 圖形介面下殺死程式點哪殺死那
[root@localhost Packages]# ps -le | grep httpd
1 S 0 2704 1 0 80 0 - 2912 - ? 00:00:00 httpd
5 S 48 2707 2704 0 80 0 - 2912 - ? 00:00:00 httpd
5 S 48 2708 2704 0 80 0 - 2912 - ? 00:00:00 httpd
5 S 48 2709 2704 0 80 0 - 2912 - ? 00:00:00 httpd
5 S 48 2710 2704 0 80 0 - 2912 - ? 00:00:00 httpd
5 S 48 2711 2704 0 80 0 - 2912 - ? 00:00:00 httpd
5 S 48 2712 2704 0 80 0 - 2912 - ? 00:00:00 httpd
5 S 48 2713 2704 0 80 0 - 2912 - ? 00:00:00 httpd
5 S 48 2714 2704 0 80 0 - 2912 - ? 00:00:00 httpd
[root@localhost Packages]# ps -aux | grep httpd
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQroot
2704 0.0 0.3 11648 3404 ? Ss 05:55 0:00 /usr/sbin/httpd apache
2707 0.0 0.2 11648 2112 ? S 05:55 0:00 /usr/sbin/httpd apache
2708 0.0 0.2 11648 2112 ? S 05:55 0:00 /usr/sbin/httpd apache
2709 0.0 0.2 11648 2112 ? S 05:55 0:00 /usr/sbin/httpd apache
2710 0.0 0.2 11648 2112 ? S 05:55 0:00 /usr/sbin/httpd apache
2711 0.0 0.2 11648 2112 ? S 05:55 0:00 /usr/sbin/httpd apache
2712 0.0 0.2 11648 2112 ? S 05:55 0:00 /usr/sbin/httpd apache
2713 0.0 0.2 11648 2112 ? S 05:55 0:00 /usr/sbin/httpd apache
2714 0.0 0.2 11648 2112 ? S 05:55 0:00 /usr/sbin/httpd root
2796 0.0 0.0 5960 752 pts/0 S+ 06:01 0:00 grep httpd
[root@localhost Packages]# killall httpd
[root@localhost Packages]# ps -aux | grep httpd
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ root
2807 0.0 0.0 5960 772 pts/0 S+ 06:02 0:00 grep httpd
[root@localhost Packages]#
改變程式的優先順序(-20,19) nice -n command & 指定程式執行優先順序
renice n pid 改變一個正在執行的程式的優先順序
top 動態 檢視程式的狀態 預設5秒改變一次
top -d 改動態顯示的時間
top -c顯示整個命令列而不是命令名
-q 立刻更新顯示的資訊
top:u 使用者 k 殺死程式 r 調節優先順序 s 修改動態更新的時間