linux 笔记 一
查看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”會強行殺掉指定進程。
轉載于:https://www.cnblogs.com/fonyer/archive/2013/03/24/2979936.html
總結
以上是生活随笔為你收集整理的linux 笔记 一的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 无法嵌入互操作类型...请改用适用的接口
- 下一篇: 求一个打耳洞的个性签名!