Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 connect to Internet using sudo wvdial on Fedora 14. The terminal needs to be kept working. My requirement is to run yum update in a separate terminal, then kill wvdial & its parent terminal and do init 0 in a single command using su -c.

Is there a way to kill child (here, sudo wvdial) and parent (here, terminal running wvdial) with a single command which can let me do the following?

su -c 'yum update; kill-child-parent-processes; init 0'

Here kill-child-parent-processes signifies the method using which I can kill sudo wvdial and its parent terminal.


share|improve this question
up vote 1 down vote accepted

You need to find out the session ID (sid) of the shell running in the terminal.

jinx:802 Z$ ps -p$$ -o sid

(Pedantry alert: usually this is the same as $$. If it's different then this may not work.) You can then use this to kill the session running in the terminal. You can't kill the terminal directly this way (it's in the window manager's session), but if the terminal is set to auto-close (as it usually is) then it will go away by itself.

jinx:803 Z$ pkill -s 17424
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.