Kill processes recursively by their process ids given in a file
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I want to be able to kill some processes.
I know the process id (that is given in file) and I do not want to do it one by one. Is there any way to do it something like calling kill
command recursively and giving it input through file or standard input like we do with rm
command...
process kill
add a comment |Â
up vote
0
down vote
favorite
I want to be able to kill some processes.
I know the process id (that is given in file) and I do not want to do it one by one. Is there any way to do it something like calling kill
command recursively and giving it input through file or standard input like we do with rm
command...
process kill
1
I don't know what you mean by "recursively", andrm
does not read from standard input.
â Kusalananda
Mar 31 at 12:25
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I want to be able to kill some processes.
I know the process id (that is given in file) and I do not want to do it one by one. Is there any way to do it something like calling kill
command recursively and giving it input through file or standard input like we do with rm
command...
process kill
I want to be able to kill some processes.
I know the process id (that is given in file) and I do not want to do it one by one. Is there any way to do it something like calling kill
command recursively and giving it input through file or standard input like we do with rm
command...
process kill
edited Mar 31 at 12:23
Kusalananda
102k13201317
102k13201317
asked Mar 31 at 12:05
Ashu
51
51
1
I don't know what you mean by "recursively", andrm
does not read from standard input.
â Kusalananda
Mar 31 at 12:25
add a comment |Â
1
I don't know what you mean by "recursively", andrm
does not read from standard input.
â Kusalananda
Mar 31 at 12:25
1
1
I don't know what you mean by "recursively", and
rm
does not read from standard input.â Kusalananda
Mar 31 at 12:25
I don't know what you mean by "recursively", and
rm
does not read from standard input.â Kusalananda
Mar 31 at 12:25
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Given a file, pids.txt
, with one process ID per line, you may do
xargs kill <pids.txt
This will invoke the kill
utility with the process IDs from the file.
Other solutions include
kill $(cat pids.txt)
which IMHO is not so elegant, and
while read pid; do
kill "$pid"
done <pids.txt
which is a lot to write to do a simple thing.
Note that none of the above variations are able to verify that the process IDs in the text file corresponds to the same processes that the process IDs were attached to at the time of creating the file.
On Linux systems, process IDs are usually incremented by one for each new process, and when the maximum allowed process ID has been used, the further IDs are allocated from some low number. This means that process IDs, over time, are re-used.
On some systems, like OpenBSD, process IDs are randomly allocated. Here too, there will be re-use of old process IDs after some time.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Given a file, pids.txt
, with one process ID per line, you may do
xargs kill <pids.txt
This will invoke the kill
utility with the process IDs from the file.
Other solutions include
kill $(cat pids.txt)
which IMHO is not so elegant, and
while read pid; do
kill "$pid"
done <pids.txt
which is a lot to write to do a simple thing.
Note that none of the above variations are able to verify that the process IDs in the text file corresponds to the same processes that the process IDs were attached to at the time of creating the file.
On Linux systems, process IDs are usually incremented by one for each new process, and when the maximum allowed process ID has been used, the further IDs are allocated from some low number. This means that process IDs, over time, are re-used.
On some systems, like OpenBSD, process IDs are randomly allocated. Here too, there will be re-use of old process IDs after some time.
add a comment |Â
up vote
1
down vote
accepted
Given a file, pids.txt
, with one process ID per line, you may do
xargs kill <pids.txt
This will invoke the kill
utility with the process IDs from the file.
Other solutions include
kill $(cat pids.txt)
which IMHO is not so elegant, and
while read pid; do
kill "$pid"
done <pids.txt
which is a lot to write to do a simple thing.
Note that none of the above variations are able to verify that the process IDs in the text file corresponds to the same processes that the process IDs were attached to at the time of creating the file.
On Linux systems, process IDs are usually incremented by one for each new process, and when the maximum allowed process ID has been used, the further IDs are allocated from some low number. This means that process IDs, over time, are re-used.
On some systems, like OpenBSD, process IDs are randomly allocated. Here too, there will be re-use of old process IDs after some time.
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Given a file, pids.txt
, with one process ID per line, you may do
xargs kill <pids.txt
This will invoke the kill
utility with the process IDs from the file.
Other solutions include
kill $(cat pids.txt)
which IMHO is not so elegant, and
while read pid; do
kill "$pid"
done <pids.txt
which is a lot to write to do a simple thing.
Note that none of the above variations are able to verify that the process IDs in the text file corresponds to the same processes that the process IDs were attached to at the time of creating the file.
On Linux systems, process IDs are usually incremented by one for each new process, and when the maximum allowed process ID has been used, the further IDs are allocated from some low number. This means that process IDs, over time, are re-used.
On some systems, like OpenBSD, process IDs are randomly allocated. Here too, there will be re-use of old process IDs after some time.
Given a file, pids.txt
, with one process ID per line, you may do
xargs kill <pids.txt
This will invoke the kill
utility with the process IDs from the file.
Other solutions include
kill $(cat pids.txt)
which IMHO is not so elegant, and
while read pid; do
kill "$pid"
done <pids.txt
which is a lot to write to do a simple thing.
Note that none of the above variations are able to verify that the process IDs in the text file corresponds to the same processes that the process IDs were attached to at the time of creating the file.
On Linux systems, process IDs are usually incremented by one for each new process, and when the maximum allowed process ID has been used, the further IDs are allocated from some low number. This means that process IDs, over time, are re-used.
On some systems, like OpenBSD, process IDs are randomly allocated. Here too, there will be re-use of old process IDs after some time.
edited Mar 31 at 12:32
answered Mar 31 at 12:24
Kusalananda
102k13201317
102k13201317
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f434659%2fkill-processes-recursively-by-their-process-ids-given-in-a-file%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
I don't know what you mean by "recursively", and
rm
does not read from standard input.â Kusalananda
Mar 31 at 12:25