killing a process (again), ports

Karl Auer kauer at biplane.com.au
Mon Mar 16 23:34:09 UTC 2009


On Mon, 2009-03-16 at 23:18 +0000, Thufir wrote:
> Are you sure it matters?
> 
> thufir at arrakis:~$ 
> thufir at arrakis:~$ ps -ae | grep fire
>  5461 ?        00:00:04 firefox
> thufir at arrakis:~$ 
> thufir at arrakis:~$ kill 5461 -9
> bash: kill: (-9) - No such process
> thufir at arrakis:~$ 
> thufir at arrakis:~$ ps -ae | grep fire
> thufir at arrakis:~$ 

Yes it does matter. What happened in the above case was that kill sent
firefox the default signal type (SIGTERM) which caused firefix to
terminate, then failed to kill process number "-9" because there was no
such process ID.

Sometimes you need to use a particular signal type. In that case, put
the signal type option first, then the list of process IDs to kill.
Otherwise you will send your processes the default signal type, which
may have an undesirable (or no) effect.

The man pages for such programs are usually very clear on where the
options belong. There is rarely any need to guess. In kill's case, this
is the syntax:

      kill [ -signal | -s signal ] pid ...

In general, use the default unless you have a specific reason to use
something else. TERM gives programs a chance to clean up and exit
gracefully, KILL (which is what -9 is) does not.

Regards, K.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)                   +61-2-64957160 (h)
http://www.biplane.com.au/~kauer/                  +61-428-957160 (mob)

GPG fingerprint: 07F3 1DF9 9D45 8BCD 7DD5 00CE 4A44 6A03 F43A 7DEF
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20090317/0b1faef1/attachment.sig>


More information about the ubuntu-users mailing list