0
0

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 1 year has passed since last update.

【Address already in use】ポートが被ってる時の対処法

Last updated at Posted at 2023-01-28

はじめに

サーバとローカルをjupyterで繋げようとした時に前のプロセスが残っていてAddress already in useとエラーが出る時の対処法

解決方法

lsof -i :[ポート番号] -t | xargs kill -9
#lsof -i :8888 -t | xargs kill -9

lsof

オプション 説明
-i 待機ポートを確認する(ネットワークソケットファイルを表示する)
-t プロセスIDの表示

xargs

標準入力やファイルからリストを読み込み、コマンドラインを作成して実行するコマンド

#例
#コマンドAの実行結果を引数にしてコマンドBを実行
コマンドA | xargs コマンドB

kill

実行中のプロセスを終了

オプション 説明
-9 強制終了

lsof -i :8888 -t | xargs kill -9

lsof -i :8888 -t:
8888番ポートで起動しているプロセスを探してプロセスIDを渡す

xargs kill -9:
受け取ったプロセスIDを用いてプロセスを強制終了

参考

https://qiita.com/toyoyuto618/items/7c281587ea66824c1233
xargs

0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?