Shih-Min Lee's Personal website

dating, chating, food, games, search

Follow me on GitHub

😀 Tiny bash script to kill a process by name

store the following code to killProc.sh

#!/bin/sh
if [ $# -ne 0  ]; then
  ps aux | grep $1 | awk '{print $2}' | xargs kill -9
else
  echo "Usage: \"sh killProc.sh\" ProcessName";
fi

and run sh killProc node to kill 1 process that contains the name node

–

01 Jul 2016