gpt4 book ai didi

linux - xargs 杀死 : Failure

转载 作者:太空宇宙 更新时间:2023-11-04 09:01:05 25 4
gpt4 key购买 nike

考虑以下命令:

ps ax | ack -i "[p]rocessname" | awk '{print $1}'

这列出了与 processname 匹配的进程的 PID。

当我试图像这样杀死每个进程时,

ps ax | ack -i "[p]rocessname" | awk '{print $1}' | xargs kill

我收到以下错误:

kill: 90632: Operation not permitted
kill: 90642: Operation not permitted
kill: 90724: Operation not permitted
kill: 90732: Operation not permitted

我在想 xargs 可能会将 pids 视为字符串而不是整数或类似的东西。或者我应该在这里使用 cut 而不是 awk(我是 awk 的新手)。有什么建议吗?

最佳答案

命令没问题。您根本无权终止 awk 返回的进程。在 Unix 中,只有 root 用户可以终止其他用户拥有的进程。

关于linux - xargs 杀死 : Failure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21240853/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com