If I run jobs with sudo
I can't kill %1
them (Operation not permitted). My first thought was to use sudo kill %1
instead, but that of course doesn't work either because it won't use the bash builtin kill
. Is there a trick to make this work?
// I know how to kill a process through it's PID. The question is specifically about how to use the job id to kill a sudo job.
man kill
,man ps
,man pgrep
,man pkill
,help jobs
builtin
, e.g.builtin kill
.sudo builtin kill -l
givessudo: builtin: command not found
sudo
won't see the same list ofjobs
. If you dosudo jobs
, you won't see%1
listed. So it will never work with%1
. You have to use the actual PID (which is effectively what Parthian's answer is doing).