Kill a user and his processes

#!/bin/sh
#
# Author: Tim Van Wassenhove
# Update: 12-12-2003 13:15
#
# This script kills all processes that are owned by a given user.
#

if [ -n "1" ]
then
        ps -ef | grep $1 | grep -v grep | awk ‘{ print }’ | xargs kill -9
else
        echo "Usage: killuser.sh username"
fi
 

Download the source for killuser.txt.

This entry was posted on Friday, December 12th, 2003 at 00:37 and is filed under Bash. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.