简体   繁体   English

如何使用 PID 杀死 Mac 进程 - QuickLookUIService

[英]How to Kill a Mac process using PID - QuickLookUIService

OSX has a stupid bug where the " QuickLookUIService " needs to be restarted to work properly. OSX 有一个愚蠢的错误,需要重新启动“ QuickLookUIService ”才能正常工作。
I want to create a script that will kill it automatically when the script is launched, but I can only achieve that by killing the Process ID .我想创建一个脚本,它会在脚本启动时自动终止它,但我只能通过终止Process ID来实现。

When I use GREP to get the PID of QuickLookUIService I get 3 results当我使用GREP获取QuickLookUIServicePID时,我得到 3 个结果

Getting the Wrong PID screenshot获取错误的 PID 屏幕截图

1

and therefore I can never get the correct PID number in order to kill it.因此我永远无法获得正确的PID号来杀死它。

I tried the following:我尝试了以下方法:

killall QuickLookUIService

ps aux | grep 'QuickLookUIService' | head -1 | cut -d " " -f 2 | xargs kill

kill $(ps aux | grep 'QuickLookUIService' | awk '{print $2}')

ps aux | grep QuickLookUIService | awk '{print $2}' | xargs kill

ps -ef  | grep -e QuickLookUIService | awk '{print $2}' | xargs sudo kill

All of which gave me the wrong PID s所有这些都给了我错误的PID

Any Help would be greatly Appriciated任何帮助将不胜感激

killall QuickLookUIService

That should work.那应该行得通。 The others are not working because by the time the list is generated a new process has been created.其他的不起作用,因为在生成列表时已经创建了一个新进程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM