Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 识别性能';使用top/ps实现s-PID_Linux_Process_Pid_Perf - Fatal编程技术网

Linux 识别性能';使用top/ps实现s-PID

Linux 识别性能';使用top/ps实现s-PID,linux,process,pid,perf,Linux,Process,Pid,Perf,我需要使用bash脚本中的PID来杀死perf。但是,无法识别性能的PID(使用top)。欢迎指点。Ubuntu XX 16.04.2。谢谢。您可以通过grep-ps查询流程并从中获取其id。然后在kill命令中使用该命令的输出 kill $(ps aux | awk '/perf/{print $2}') 这起作用了。只需搜索整个单词perf并反转grep其他PID,包括grep和perf shell命令(stat)。$ps aux|grep-w'perf'|grep-v'grep'| gr

我需要使用bash脚本中的PID来杀死perf。但是,无法识别性能的PID(使用top)。欢迎指点。Ubuntu XX 16.04.2。谢谢。

您可以通过grep-ps查询流程并从中获取其id。然后在kill命令中使用该命令的输出

kill $(ps aux | awk '/perf/{print $2}')

这起作用了。只需搜索整个单词perf并反转grep其他PID,包括grep和perf shell命令(stat)。$ps aux|grep-w'perf'|grep-v'grep'| grep-v'stat'| awk'{print$2}'我觉得很愚蠢'caz没有在ps上做一个简单的名称搜索:)kill$(ps aux|awk'/perf/{print$2})也终止了perf在使用
pidof
和/org
pgrep中运行的屏幕会话,以查找性能进程;并非所有“进程名称”中包含perf的进程都发现“pidof”命令在查找PID时非常有用。然后使用kill-SIGHUP$(pidof perf)终止进程