たま〜にやる、 netstat だっけ? lsof だっけ? とかなる作業を Claude にやってもらった。 lsof -i はアドレスを指定できるらしい。
-i [i]
selects the listing of files any of whose Internet address matches
the address specified in i. If no address is specified, this
option selects the listing of all Internet and x.25 (HP-UX)
network files.
(snip)やり取りはこんなの:
> なんかやったときのプロセスが残ってそうで、3000番ポートがあいてない。プロセスを確認して
⏺ 3000番ポートを使用しているプロセスを確認します。
⏺ Bash(lsof -i :3000)
⎿ COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 55491 hogashi 15u IPv6 0xXXXXXXXXXXXXXXXX 0t0 TCP *:hbci (LISTEN)
⏺ 3000番ポートでnodeプロセスが動いています:
- プロセス: node
- PID: 55491
- ユーザー: hogashi
このプロセスを停止する場合は、以下のコマンドを実行できます:
kill 55491
または、強制終了する場合は:
kill -9 55491
プロセスを停止しますか?
> y
⏺ Bash(kill 55491)
⎿ (No content)
⏺ Bash(lsof -i :3000)
⎿ Error: Exit code 1
⏺ プロセスを停止しました。3000番ポートは現在空いています。