7 examples for kill
# Sends a "SIGKILL" signal to process with id 925. The -9 option sends the kill signal. The 925 id was found by using 'ps'. kill -9 925
# kill -0 PID determines if PID is running (without locking the kernel process table or forking new shell) kill -0 $(cat $PIDFILE) || breakLockRestart "Daemon died; restarting." kill -0 $(cat $PIDFILE) && die "$0 already running. Exiting."
# Kill a process by grepping its process name, replace [p]rocessname with your own process, surround first char with [] ps aufx | grep [p]rocessname | awk -v N=2 '{print $N}' | sudo xargs kill -9
# The example given recently with surrounding first char of the process # name with [] is nearly correct. Additionally you have to enclose the # command name in quotation marks! Try those both commands: # # 1. echo [m]y_command # 2. echo "[m]ycommand" # # If you would like to kill a process by filtering ps output with grep, # you could write the following. As mentioned: replace "[p]rocessname" # with your own process it's name, surround first char with [] AND embed # the whole process name in quotation marks. kill -15 "$(ps ax | grep "[p]rocessname" | cut -d' ' -f1)"