Ubuntu下關閉佔用埠的程式更

陌如煙雨淡如塵發表於2017-06-02

1.檢視該埠的佔用情況
lsof -i:埠號
2.關閉程式
kill PID

rubyhou@ubuntu:~/workspace/sample_app$ lsof -i:3000
COMMAND  PID    USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
ruby    3715 rubyhou   11u  IPv4  25229      0t0  TCP *:3000 (LISTEN)
ruby    3868 rubyhou   11u  IPv4  25229      0t0  TCP *:3000 (LISTEN)
rubyhou@ubuntu:~/workspace/sample_app$ kill 3715
rubyhou@ubuntu:~/workspace/sample_app$ kill 3868
rubyhou@ubuntu:~/workspace/sample_app$ lsof -i:3000
rubyhou@ubuntu:~/workspace/sample_app$ 
rubyhou@ubuntu:~/workspace/sample_app$ 
rubyhou@ubuntu:~/workspace/sample_app$ 

相關文章