查看进程: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 修改动态更新的时间