用該命令可以找出使用端口的進程。可寫腳本監控,停止端口及進程~
例如:fuser -n tcp 3306 | ps aux | grep 24594 | grep -v "grep"
若要將使用該端口的進程kill
例如:fuser -k -n tcp 3306
usage: fuser [ -a | -s ] [ -n space ] [ -signal ] [ -kimuv ] name ...
[ - ] [ -n space ] [ -signal ] [ -kimuv ] name ...
fuser -l
fuser -V
-a display unused files too
-k kill processes aclearcase/" target="_blank" >ccessing that file
-i ask before killing (ignored without -k)
-l list signal names
-m mounted FS
-n space search in the specified name space (file, udp, or tcp)
-s silent operation
-signal send 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]]]