首页IT科技killthe game(Kill the undesired UNIX processes in one go)

killthe game(Kill the undesired UNIX processes in one go)

时间2025-08-01 12:53:45分类IT科技浏览5798
导读:Kill the undesired UNIX processes in one go...

Kill the undesired UNIX processes in one go

Contributed by roshi

Tagged: UNIX
Browse to next tech-recipes article

This recipe is useful when one wants to kill all the processes belonging to one user or having a particular regular expression in the process name.

One can use different options of “ps              ” and “grep                     ” to kill the undesired process(es).

The following is the general syntax of this recipe

ps -u | grep

| awk {print $1} | xargs kill -9

ps -u

will find all the processes of the user username.

This output is then greped for processname_pattern which is then piped to awk

.

awk ‘{print $1}’

will print only the first column of the output (the process-id, in this case).

This is then xargd to the kill with sure kill -9 signal.

As a result,all the undesired processes will be killed.

Note : One should give the processname_pattern carefully as an incorrect

regular expression may lead to even desired processes being killed.
声明:本站所有文章              ,如无特殊说明或标注                    ,均为本站原创发布              。任何个人或组织       ,在未征得本站同意时              ,禁止复制              、盗用                     、采集      、发布本站内容到任何网站       、书籍等各类媒体平台                     。如若本站内容侵犯了原著者的合法权益                    ,可联系我们进行处理      。

创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!

展开全文READ MORE
提高选择性是什么意思(提高选择性因子的方法) 微软nlp组(【历史上的今天】3 月 13 日:Windows NT 之父出生;首届无人车顶级赛事;微软上市)