hi,
I know the kill command can kill a process ID, but it is normally done by
two command: firstly show the proc id and then kill. Does any one know how
to do it in a single command line? ie. kill -HUP | ps ..... inet ??
Thanks
Sam
I know the kill command can kill a process ID, but it is normally done by
two command: firstly show the proc id and then kill. Does any one know how
to do it in a single command line? ie. kill -HUP | ps ..... inet ??
Thanks
Sam
> I know the kill command can kill a process ID, but it is normally done by
> two command: firstly show the proc id and then kill. Does any one know how
> to do it in a single command line? ie. kill -HUP | ps ..... inet ??
--
Biology/Neuroscience, Pre-med | http://home.uchicago.edu/~dpryan
Maybe:Quote:> I know the kill command can kill a process ID, but it is normally done by
> two command: firstly show the proc id and then kill. Does any one know how
> to do it in a single command line? ie. kill -HUP | ps ..... inet ??
But, there is 'skill' (/usr/ports/sysutils/skill) that you can use by
giving the name of the process instead of PID:
~# skill -HUP inet
regards,
--
I believe the technical term is "Oops!"
> hi,
> I know the kill command can kill a process ID, but it is normally done by
> two command: firstly show the proc id and then kill. Does any one know how
> to do it in a single command line? ie. kill -HUP | ps ..... inet ??
does what you want.
--
Stephen Montgomery-Smith
http://www.math.missouri.edu/~stephen
in general, no.Quote:> hi,
> I know the kill command can kill a process ID, but it is normally done by
> two command: firstly show the proc id and then kill. Does any one know how
> to do it in a single command line? ie. kill -HUP | ps ..... inet ??
> Thanks
> Sam
in another case you may need to kill any process attached to a particular
tty
or any process that has anything to do with the X server...
in the simplest case, if you know for a fact that there is only one instance
of a particular program, and you know exactly how to regexp for that program
in the list, then you could do something like this:
kill -HUP `ps -ef |awk '($8 == "theprogram"){print $2}'`
which means, if field 8 is "theprogram" then kill the process number in
field 2
but this is unsafe, even though I have provided a more precise example here
than some others you would see if you had searched google groups for "awk
kill"
which all go like:
kill -HUP `ps -ef |awk '/theprogram/{print $2}'`
which means if "theprogram" occurs anywhere in the line, then print field 2,
and kill tries to kill it. this is more likely to get the wrong line, or get
multiple lines.
basically if you can write a script that parses the output of ps and spits
out a single pid, then you can do "kill -HUP `script`" but what that script
amounts to depends entirely on criteria only you know such as what exactly
do you need to kill?
there is no one size fits all answer.
bahh, those were sco unix examples, here is the equivalent on freebsd:
(looking for lpd in this case)
kill -HUP `ps auxwww | awk '($11 == "/usr/sbin/lpd"){print $2}'`
--
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx Linux SCO Prosper/FACTS AutoCAD #callahans Satriani
> hi,
> I know the kill command can kill a process ID, but it is normally done by
> two command: firstly show the proc id and then kill. Does any one know how
> to do it in a single command line? ie. kill -HUP | ps ..... inet ??
> Thanks
> Sam
*!*!* DO NOT HIT REPLY *!*!*
ALL EMAIL SENT TO REPLY ADDRESS WILL BE DELETED!
kill -HUP `ps -auxwww | awk '/luser/ { print $2 }'
If you want to kill -HUP all the processes called inetd you can
do:
killall -HUP inetd
David.
1. Piping process IDs into kill command
I have worked out the following command that displays PID
numbers for processes involving a script (in tcsh) named .filebif:
ps -g |grep .filebif |grep '[0-9]*[0-9]*[0-9]*[0-9]*[0-9]*' |cut -c1-5
Which results in output like this:
5473
27483
I would like to then execute a kill command with the first, or
both, of these numbers as arguments, but haven't figured out how to
automate this. If I could pipe them into a variable (using tcsh syntax:
"set var=value"), I could issue a "kill $var", but don't know how to get
command output into a variable. Or perhaps there is a more direct syntax
to feed them to "kill" without needing a variable? Advice appreciated.
--Donald Davis
3. Is there a command to get the status of a particular Process ID (not ps)
4. Setting up a Linux Box as a Firewall for Win9x?
5. Increase root slice on Ultra1 5.5.1
6. how to kill a process extracted from ps command?
9. How can kill all child processes without killing parent process ?
10. A method to kill process that cannot be killed even with `kill -9'.
11. How to kill process which not killed by 'kill' ?
12. Newbie. find and kill by parent process id