How to identify the process listening on a port

Home/Linux, Security/How to identify the process listening on a port

This is mostly for own use, but: If you’ve ever had a server which netstat showed was listening on one or more ports you weren’t expecting, you can use this command to find out which process is listening there:

fuser -vn tcp 4444

Which in this case happens to be owned by JBoss, and not some linux version of a windows worm:)

For more info on fuser, check out the man page, or the simple help below:

Usage: fuser [ -a | -s | -c ] [ -n SPACE ] [ -SIGNAL ] [ -kimuv ] NAME...
[ - ] [ -n SPACE ] [ -SIGNAL ] [ -kimuv ] NAME...
fuser -l
fuser -V
Show which processes use the named files, sockets, or filesystems.
-a display unused files too
-c mounted FS
-f silently ignored (for POSIX compatibility)
-i ask before killing (ignored without -k)
-k kill processes accessing the named file
-l list available signal names
-m show all processes using the named filesystems
-n SPACE search in this name space (file, udp, or tcp)
-s silent operation
-SIGNAL send this signal instead of SIGKILL
-u display user IDs
-v verbose output
-V display version information
-4 search IPv4 sockets only
-6 search IPv6 sockets only
- reset options
udp/tcp names: [local_port][,[rmt_host][,[rmt_port]]]

By | 2008-04-03T22:34:22+00:00 November 27th, 2007|Linux, Security|2 Comments

About the Author:

2 Comments

  1. Error source port December 8, 2009 at 1:34 am - Reply

    […] ] [ -SIGNAL ] [ -kimuv ] NAME… [ – ] [ -n SPACE ] [ -SIGNAL ] [ -kimuv ] NAME… etc website How to identify the process listening on a port | Devon Hillard Tech Blog […]

  2. Devon April 18, 2011 at 8:20 am - Reply

    Or:

    lsof -i :80

Leave A Comment