Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to kill a process in Ubuntu.

I have Java installed and Running JBOSS & Tomcat at background. I need to kill Tomcat after deployment but when I kill it JBOSS is going too.

I had to use

kill -9 pidofjava
killall tomcat

But status is still same.

What I need to do to kill a process attribute? I mean subprocess?

share|improve this question

Usually processes check whether their subprocesses are still alive and might shut down themselves if one of the subprocesses is aborted.

share|improve this answer

You can loop through the process list, identifying children with the same parent and kill them one by one.


while true
  echo "Enter parent process id  [type quit for exit]"
  read ppid

  if [ $ppid -eq "quit" -o $ppid -eq "QUIT" ];then
     exit 0

  for i in `ps -ef| awk '$3 == '$ppid' { print $2 }'`
      echo killing $i
      kill $i

You can also kill by session id but that get's the parent and the children.

ps -eo pid,ppid,sess,cmd -u ppetraki | grep whoami

pkill -9 -s SESS_ID

Using the information from the later, you could build a simpler tool that targeted only children.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.