Linux Tools: fuser
Find what process is listening on a specific port
List all listening ports
netstat -l
Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 :9090:* LISTEN
tcp 0 0 :nrpe:* LISTEN
fuser is given the (-n) tcp namespace
$sudo fuser -n tcp 9090
The output is a list of processes associated with that port , 9090 in this example.
9090/tcp: 8794 26222 26223 26224 26225 26226 26227 26228 26229 26230 26231
Who’s accessing that mount ?
Sometimes when you’re trying to unmount a drive you’ll get a message saying the device is busy. With fuser you can find the process accessing the device.
fuser -v (verbose) -m (mounting point) /path/to/mount
$sudo fuser -v -m /mnt/nfsshare/
…………………USER PID ACCESS COMMAND
/mnt/nfsshare/: edwin 25740 ..c.. bash
It was me!
Take a look at the fuser man pages for information on the different types of access.