you need to use the command lsof
, then the argument will be the directory you want to kill.
#!/usr/bin/env bash
lsof $(pwd) | \
awk -F " " ' { print $2 } ' | \
while read process ; do
[[ ${process} == "PID" ]] && continue;
echo ${process};
done
source
share