OSX has a stupid bug where the " QuickLookUIService " needs to be restarted to work properly.
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 .
When I use GREP to get the PID of QuickLookUIService I get 3 results
Getting the Wrong PID screenshot
and therefore I can never get the correct PID number in order to kill it.
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
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.