3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

プロセスを一括でkillする方法

Posted at

chromedriverのプロセスがたくさん溜まってしまいましたが、
プロセス番号を使って順番にkillコマンドでkillすると非常に効率が悪いです。

$ ps aux|grep chromedriver
yusaku            8013   0.0  0.1  4360484  12024 s001  S     1:01PM   0:00.22 /Users/yusaku/chromedriver --port=53472
yusaku            2932   0.0  0.1  4360484  11992 s001  S    12:25AM   0:00.25 /Users/yusaku/chromedriver --port=64392
yusaku            2880   0.0  0.1  4360484  11988 s001  S    12:25AM   0:00.26 /Users/yusaku/chromedriver --port=64302
yusaku            2512   0.0  0.1  4360484  12256 s001  S    12:07AM   0:00.28 /Users/yusaku/chromedriver --port=63331
yusaku           99432   0.0  0.1  4360620  12268 s001  S     8:08PM   0:00.36 /Users/yusaku/chromedriver --port=56561
yusaku           99261   0.0  0.1  4360620  12252 s001  S     7:59PM   0:00.48 /Users/yusaku/chromedriver --port=56221
yusaku           98284   0.0  0.1  4360620  12236 s001  S    土05PM   0:00.60 /Users/yusaku/chromedriver --port=55684
yusaku           98202   0.0  0.1  4360620  12240 s001  S    土05PM   0:00.43 /Users/yusaku/chromedriver --port=55487
yusaku           98120   0.0  0.1  4360620  12256 s001  S    土05PM   0:00.44 /Users/yusaku/chromedriver --port=55307
yusaku           98031   0.0  0.1  4360620  12320 s001  S    土05PM   0:00.33 /Users/yusaku/chromedriver --port=55113
yusaku           97976   0.0  0.1  4360484  12268 s001  S    土05PM   0:00.35 /Users/yusaku/chromedriver --port=55082
yusaku           97891   0.0  0.1  4360620  12540 s001  S    土05PM   0:00.51 /Users/yusaku/chromedriver --port=54923
yusaku           97807   0.0  0.1  4360620  12464 s001  S    土05PM   0:00.44 /Users/yusaku/chromedriver --port=54755
yusaku           97014   0.0  0.1  4360484  12004 s001  S    土04PM   0:00.34 /Users/yusaku/chromedriver --port=53365
yusaku           96928   0.0  0.1  4360484  11992 s001  S    土04PM   0:00.31 /Users/yusaku/chromedriver --port=53308
yusaku           96873   0.0  0.1  4360484  12000 s001  S    土04PM   0:00.31 /Users/yusaku/chromedriver --port=53169
yusaku           96811   0.0  0.1  4360484  12016 s001  S    土04PM   0:00.34 /Users/yusaku/chromedriver --port=53027
yusaku           95623   0.0  0.1  4360484  11984   ??  S    土03PM   0:00.32 /Users/yusaku/chromedriver --port=52319
yusaku           95584   0.0  0.1  4360484  12012   ??  S    土03PM   0:00.32 /Users/yusaku/chromedriver --port=52297
yusaku           95533   0.0  0.1  4360484  12012   ??  S    土03PM   0:00.34 /Users/yusaku/chromedriver --port=52151
yusaku           95495   0.0  0.1  4360484  12000   ??  S    土03PM   0:00.33 /Users/yusaku/chromedriver --port=52133
yusaku           95445   0.0  0.1  4360484  11988   ??  S    土03PM   0:00.32 /Users/yusaku/chromedriver --port=51998
yusaku           95405   0.0  0.1  4360484  12000   ??  S    土03PM   0:00.31 /Users/yusaku/chromedriver --port=51979
yusaku           95340   0.0  0.1  4360484  11976   ??  S    土03PM   0:00.32 /Users/yusaku/chromedriver --port=51817
yusaku           95280   0.0  0.1  4360484  11984   ??  S    土03PM   0:00.35 /Users/yusaku/chromedriver --port=51679
yusaku           95214   0.0  0.1  4360484  12004   ??  S    土03PM   0:00.31 /Users/yusaku/chromedriver --port=51621
yusaku           95160   0.0  0.1  4360484  11996   ??  S    土03PM   0:00.31 /Users/yusaku/chromedriver --port=51589
yusaku           95068   0.0  0.1  4360484  11984   ??  S    土03PM   0:00.31 /Users/yusaku/chromedriver --port=51404
yusaku           95026   0.0  0.1  4360484  12008   ??  S    土03PM   0:00.31 /Users/yusaku/chromedriver --port=51385
yusaku           94964   0.0  0.1  4360484  11972   ??  S    土03PM   0:00.32 /Users/yusaku/chromedriver --port=51310
yusaku           94891   0.0  0.1  4360484  12008   ??  S    土03PM   0:00.31 /Users/yusaku/chromedriver --port=51265
yusaku           94795   0.0  0.1  4368688  12228   ??  S    土03PM   0:00.32 /Users/yusaku/chromedriver --port=50551
yusaku           94743   0.0  0.1  4360484  12280   ??  S    土03PM   0:00.33 /Users/yusaku/chromedriver --port=50411
yusaku           94627   0.0  0.1  4360484  12272   ??  S    土03PM   0:00.32 /Users/yusaku/chromedriver --port=50249
yusaku           94565   0.0  0.1  4360484  12284   ??  S    土03PM   0:00.33 /Users/yusaku/chromedriver --port=50088
yusaku           94508   0.0  0.1  4360484  12260   ??  S    土03PM   0:00.34 /Users/yusaku/chromedriver --port=49947
yusaku           94016   0.0  0.1  4360484  12244   ??  S    土03PM   0:00.32 /Users/yusaku/chromedriver --port=49324
yusaku           93963   0.0  0.1  4360484  12248   ??  S    土03PM   0:00.33 /Users/yusaku/chromedriver --port=49179
yusaku           93910   0.0  0.1  4360484  12204   ??  S    土03PM   0:00.32 /Users/yusaku/chromedriver --port=65531
yusaku           93859   0.0  0.1  4360484  12232   ??  S    土03PM   0:00.37 /Users/yusaku/chromedriver --port=65390
yusaku           93808   0.0  0.1  4360484  12220   ??  S    土03PM   0:00.37 /Users/yusaku/chromedriver --port=65259
yusaku           93758   0.0  0.1  4360484  12212   ??  S    土03PM   0:00.32 /Users/yusaku/chromedriver --port=65231
yusaku           93607   0.0  0.1  4360484  12236   ??  S    土03PM   0:00.36 /Users/yusaku/chromedriver --port=64962
yusaku           11837   0.0  0.0  4277992   1008 s001  S+    7:36PM   0:00.00 grep chromedriver
yusaku           11749   0.0  0.2  4360484  13808 s001  S     7:30PM   0:00.06 /Users/yusaku/chromedriver --port=58743
yusaku           11636   0.0  0.2  4360484  13836 s001  S     7:28PM   0:00.07 /Users/yusaku/chromedriver --port=58678

一括でkillする方法

pgrepxargs を使えば一括にkill出来る。

$ pgrep chromedriver| xargs kill -9
$
$ ps aux|grep chromedriver
yusaku           11934   0.0  0.0  4267752   1008 s001  S+    7:48PM   0:00.01 grep chromedriver
3
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?