ps -le | grep httpd 查看程序httpd所开启的进程 kill (pid) 就能杀死相应的进程。如果想杀死一个程序的所有进程,则需要杀死子进程的父进程。(速度快) [gxl@localhost ~]$ pstree init─┬─acpid ├─avahi-daemon───avahi-daemon ├─cupsd ├─daemondaemon ├─2*[dbus-daemon] ├─dbus-launch ├─dcopserver ├─gam_server ├─hald───hald-runner─┬─hald-addon-acpi │ ├─2*[hald-addon-keyb] │ └─hald-addon-stor ├─hcid ├─hidd ├─httpd───9*[httpd] ├─kded ├─kdeinit─┬─artsd │ ├─kio_file │ ├─klauncher │ ├─konqueror───kdesu───rfuser │ └─kwin ├─kdesktop ├─kicker ├─klipper ├─klogd ├─kmix ├─knotify ├─konqueror ├─korgac ├─ksmserver ├─6*[mingetty] ├─mysqld_safe───mysqld───{mysqld} ├─netconfiguistat ├─netd ├─powersaved ├─prefdm───kdm─┬─X │ └─kdm───startkde───kwrapper ├─scim-helper-man ├─2*[scim-launcher] ├─sdpd ├─shared ├─skim───{skim} ├─smbd───smbd ├─sshd───sshd───sshd───bash───su───bash───su───bash───pstree ├─start_kdeinit ├─syslogd └─udevd 一个简单的shell程 /root/Desktop/gg.sh (`这是在桌面上的脚本) #!/bin/sh #This is to show what a example looks like. echo "Our first example" echo # This inserts an empty line in output. echo "We are currently in the following directory." /bin/pwd echo echo "This directory contains the following files" /bin/ls 写入:vi /root/Desktop/gg.sh 写好之后 :wq! (保存退出) ( :w gg001.sh 保存到一个新的文件中去) 执行shell脚本: sh /root/Desktop/gg.sh 接下来就会输出脚本功能执行的内容
转载于:https://www.cnblogs.com/gxldan/archive/2011/07/10/4066679.html