Some time we want to know the process id using port number.Following is the command to use
Syntax: $ lsof -i tcp:PORT_NUMBER
Example: lsof -i tcp:3000
Output:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
firefox-b 1837 ravi 46u IPv4 87572 0t0 TCP localhost:51945->localhost:
ruby 2846 ravi 8u IPv4 49836 0t0 TCP *:3000 (LISTEN)
ruby 2846 ravi 9u IPv4 78566 0t0 TCP localhost:3000->localhost:
In output we can see 2846 is the ruby server id.
No comments:
Post a Comment