查看apache是否开启
pidof httpd
ps -aux | grep httpd
ps -ef| grep httpd
pgrep httpd
开启[停止|重启]
/usr/sbin/apachectl start[stop|restart]
/etc/init.d/httpd start[stop|restart]
service httpd start[stop|restart]
开机启动
在/etc/rc.d/rc.local中增加启动apache的命令,例如:/usr/local/httpd/bin/apachectl start

查看80端口
netstat -anl|grep ':80'
终止进程
kill -s 9 `ps -aux | grep firefox | awk '{print $2}'`
pkill -9 httpd
killall -9 firefox
ps -ef | grep firefox | grep -v grep | cut -c 9-15 | xargs kill -s 9

说明:
“grep firefox”的输出结果是,所有含有关键字“firefox”的进程。
“grep -v grep”是在列出的进程中去除含有关键字“grep”的进程。
“cut -c 9-15”是截取输入行的第9个字符到第15个字符,而这正好是进程号PID。
“xargs kill -s 9”中的xargs命令是用来把前面命令的输出结果(PID)作为“kill -s 9”命令的参数,并执行该命令。“kill -s 9”会强行杀掉指定进程。

posted on 2013-03-24 23:28  fonyer  阅读(184)  评论(0编辑  收藏  举报