fuser命令可以找出使用端口的进程。
若要将使用该端口的进程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 accessing 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]]]
eg:
[root@GCC ~]# fuser -n tcp 21
here: 21
21/tcp: 3798
[root@GCC ~]# ps -ef|grep 3798
root 3798 1 0 11:19 ? 00:00:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
root 9684 9195 0 14:57 pts/1 00:00:00 grep 3798