Thursday, May 28, 2015

Find out what is running on a given port


1. Find out what is running on a given port

$sudo lsof -i :4567
Password:

COMMAND   PID  USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
ruby    86461 zepho    9u  IPv6 0xffffff803ac28f80      0t0  TCP localhost:tram (LISTEN)
ruby    86461 zepho   10u  IPv4 0xffffff8022e51c00      0t0  TCP localhost:tram (LISTEN)
ruby    86461 zepho   11u  IPv6 0xffffff802197bac0      0t0  TCP localhost:tram (LISTEN)

2. Check what process is running with that process id.

$ ps aux | grep 86461
zepho          86461   0.0  0.1  2492352  18280 s005  T     4:59PM   0:00.31 ruby hello.rb
zepho          91001   0.0  0.0  2434892    460 s005  R+    8:37PM   0:00.00 grep 86461

3. Kill that mother fucker like this:

$ kill -9 86461