ポート番号「8000」を指定して作業を進めていたのに、突然「ポートが既に使用中です」とエラーが出てしまった経験、ありませんか?そんなとき役立つのが、今回ご紹介する lsof -i :8000 というコマンドです。実はこれ、とても簡単で強力な道具なんです。
lsofコマンドでまず覚えておきたいのは、次のように引数にファイルパスを指定する方法だ。 % lsof /dev/null COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME adjkerntz 148 root 0u VCHR 0,26 0t0 26 /dev/null adjkerntz 148 root 1u VCHR 0,26 0t0 26 ...
If you’re running Mac or Linux, you will already have this command installed. lsof tells you what a process is currently talking to. It will list the process’ network connections and which files it’s ...
sh-5.0# /root/lsof/lsof -i | grep LI nc 960 root 3u IPv4 2998531 0t0 TCP localhost:garcon (LISTEN) However, there is no way to print the state of UNIX domain socket. print_tcptpi called from ...
lsofはLinuxディストリビューションによってデフォルトでインストールされていたり、されていなかったりする。ただし ...