macos 在 Mac OS X 中使用命令行杀死“loginwindow”进程
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10620606/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Kill "loginwindow" process using command line in Mac OS X
提问by MorganR
So far, I have written the following unix command:
到目前为止,我已经编写了以下 unix 命令:
ps -Ajc | grep loginwindow | cut -c 16-20 | sed 's/ //g'
This grabs the "loginwindow" process, filters it using cut and sed to return the number of the "loginwindow" process.
这会抓取“loginwindow”进程,使用 cut 和 sed 对其进行过滤以返回“loginwindow”进程的编号。
I'd like to know how to use the number retrieved to the process.
我想知道如何使用检索到的号码。
Thank you.
谢谢你。
回答by Gordon Davisson
This seems like the long way around. Why not just use killall loginwindow
?
这似乎还有很长的路要走。为什么不直接使用killall loginwindow
?
回答by aztaroth
kill `ps -Ajc | grep loginwindow | cut -c 16-20 | sed 's/ //g'`