Linux version: CentOS 7
[weizhong@bja /tmp]
$ll apis_response_time_analysis.pid
-rw-r--r-- 1 weizhong users 5 Jan 22 09:40 apis_response_time_analysis.pid
[weizhong@bja /tmp]
$cat apis_response_time_analysis.pid
20795
[weizhong@bja /tmp]
$sudo ps -ef | grep 20795
weizhon+ 24876 9196 0 11:41 pts/2 00:00:00 grep --color=auto 20795
I can't find the PID, then I've tried to kill it by my account. However, it saied Operation not permitted instead of No such process
[weizhong@bja /tmp]
$kill -9 20795
-bash: kill: (20795) - Operation not permitted
[weizhong@bja /tmp]
$kill -9 20795123 <--- a pid not exists
-bash: kill: (20795123) - No such process
then I tried to kill it with sudo
, I've executed
[weizhong@bja /tmp]
$sudo kill 20795 <-- no output
[weizhong@bja /tmp]
$sudo kill -9 20795
kill: sending signal to 20795 failed: No such process
Then I executed by my account again
[weizhong@bja /tmp]
$kill 20795
-bash: kill: (20795) - No such process
I'm sure that pid 20795 is generated by my account. Currently I can't find 20795, but when I kill it, return Operation not permitted
instead of No such process
, I wanna know why, and why my process need to be killed by sudo
ps -ef
gives the same listing regardless ofsudo
. It looks like PID 20795 was free at the time you performed thegrep
, but was then allocated to another process. Or it could have been a thread ID, but I don't know whatkill
does with TIDs.