网络安全校招岗位全解析:安全运维、渗透测试与安全开发入门指南
2026/9/8 16:36:08
在 Linux 和部分 Unix 系统中,killall命令十分实用,它能杀死所有匹配指定模式的运行进程。若系统没有该命令,可通过 shell 脚本模拟实现。
#!/bin/sh # killall - Sends the specified signal to all processes that match a # specific process name. # By default it only kills processes owned by the same user, unless # you're root. Use -s SIGNAL to specify a signal to send to the process, # -u user to specify the user, -t tty to specify a tty, # and -n to only report what'd be done, rather than doing it. signal="-INT" # default signal user="" tty="" donothing=0 while getopts "s:u:t:n" opt; do case "$opt" in # Note the trick below: kill wants -SIGNAL but we're asking # for SIGNAL so w