# 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)"