如何在Window或Linux/Unix中查找并干掉占用指定端口的进程
来源:互联网 发布:神像仓库升级数据 编辑:程序博客网 时间:2024/04/30 06:05
Windows
netstat /?
Displays protocol statistics and current TCP/IP network connections.NETSTAT [-a] [-b] [-e] [-n] [-o] [-p proto] [-r] [-s] [-v] [interval] -a Displays all connections and listening ports. -b Displays the executable involved in creating each connection or listening port. In some cases well-known executables host multiple independent components, and in these cases the sequence of components involved in creating the connection or listening port is displayed. In this case the executable name is in [] at the bottom, on top is the component it called, and so forth until TCP/IP was reached. Note that this option can be time-consuming and will fail unless you have sufficient permissions. -e Displays Ethernet statistics. This may be combined with the -s option. -n Displays addresses and port numbers in numerical form. -o Displays the owning process ID associated with each connection. -p proto Shows connections for the protocol specified by proto; proto may be any of: TCP, UDP, TCPv6, or UDPv6. If used with the -s option to display per-protocol statistics, proto may be any of: IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, or UDPv6. -r Displays the routing table. -s Displays per-protocol statistics. By default, statistics are shown for IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, and UDPv6; the -p option may be used to specify a subset of the default. -v When used in conjunction with -b, will display sequence of components involved in creating the connection or listening port for all executables. interval Redisplays selected statistics, pausing interval seconds between each display. Press CTRL+C to stop redisplaying statistics. If omitted, netstat will print the current configuration information once.
netstat -o
Proto Local Address Foreign Address State PID ... TCP IXX-L3YWERK:3521 localhost:3306 ESTABLISHED 5892 TCP IXX-L3YWERK:3522 localhost:3306 ESTABLISHED 5892 TCP IXX-L3YWERK:3524 localhost:3306 ESTABLISHED 5892 TCP IXX-L3YWERK:3525 localhost:3306 ESTABLISHED 5892 TCP IXX-L3YWERK:3526 localhost:3306 ESTABLISHED 5892 TCP IXX-L3YWERK:3527 localhost:3306 ESTABLISHED 5892 TCP IXX-L3YWERK:3528 localhost:3306 ESTABLISHED 5892 TCP IXX-L3YWERK:3529 localhost:3306 ESTABLISHED 5892 TCP IXX-L3YWERK:3530 localhost:3306 ESTABLISHED 5892 ...
taskkill /?
TASKKILL [/S system [/U username [/P [password]]]] { [/FI filter] [/PID processid | /IM imagename] } [/F] [/T]Description: This command line tool can be used to end one or more processes. Processes can be killed by the process id or image name.Parameter List: /S system Specifies the remote system to connect to. /U [domain/]user Specifies the user context under which the command should execute. /P [password] Specifies the password for the given user context. Prompts for input if omitted. /F Specifies to forcefully terminate process(es). /FI filter Displays a set of tasks that match a given criteria specified by the filter. /PID process id Specifies the PID of the process that has to be terminated. /IM image name Specifies the image name of the process that has to be terminated. Wildcard '*' can be used to specify all image names. /T Tree kill: terminates the specified process and any child processes which were started by it. /? Displays this help/usage.Filters: Filter Name Valid Operators Valid Value(s) ----------- --------------- -------------- STATUS eq, ne RUNNING | NOT RESPONDING IMAGENAME eq, ne Image name PID eq, ne, gt, lt, ge, le PID value SESSION eq, ne, gt, lt, ge, le Session number. CPUTIME eq, ne, gt, lt, ge, le CPU time in the format of hh:mm:ss. hh - hours, mm - minutes, ss - seconds MEMUSAGE eq, ne, gt, lt, ge, le Memory usage in KB USERNAME eq, ne User name in [domain/]user format MODULES eq, ne DLL name SERVICES eq, ne Service name WINDOWTITLE eq, ne Window titleNOTE: Wildcard '*' for the /IM switch is accepted only with filters.NOTE: Termination of remote processes will always be done forcefully irrespective of whether /F option is specified or not.Examples: TASKKILL /S system /F /IM notepad.exe /T TASKKILL /PID 1230 /PID 1241 /PID 1253 /T TASKKILL /F /IM notepad.exe /IM mspaint.exe TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*" TASKKILL /F /FI "USERNAME eq NT AUTHORITY/SYSTEM" /IM notepad.exe TASKKILL /S system /U domain/username /FI "USERNAME ne NT*" /IM * TASKKILL /S system /U username /P password /FI "IMAGENAME eq note*"
除了使用taskkill外,还可以通过快捷键Ctrl + Shift + Esc打开任务管理器,在它的“Process”或“进程”页签下找到对应的PID来结束任务!
Linux/Unix
netstat --help
usage: netstat [-vWeenNcCF] [] -r netstat {-V|--version|-h|--help} netstat [-vWnNcaeol] [ ...] netstat { [-vWeenNac] -i | [-cWnNe] -M | -s } -r, --route display routing table -i, --interfaces display interface table -g, --groups display multicast group memberships -s, --statistics display networking statistics (like SNMP) -M, --masquerade display masqueraded connections -v, --verbose be verbose -W, --wide don't truncate IP addresses -n, --numeric don't resolve names --numeric-hosts don't resolve host names --numeric-ports don't resolve port names --numeric-users don't resolve user names -N, --symbolic resolve hardware names -e, --extend display other/more information -p, --programs display PID/Program name for sockets -c, --continuous continuous listing -l, --listening display listening server sockets -a, --all, --listening display all sockets (default: connected) -o, --timers display timers -F, --fib display Forwarding Information Base (default) -C, --cache display routing cache instead of FIB ={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom =Use '-6|-4' or '-A ' or '--'; default: inet List of possible address families (which support routing): inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25) netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP) x25 (CCITT X.25)
netstat -lp
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name...tcp 0 0 *:amandaidx *:* LISTEN -tcp 0 0 localhost:amidxtape *:* LISTEN -tcp 0 0 *:8808 *:* LISTEN -tcp 0 0 PKG-LOCAL-SERVER.:mysql *:* LISTEN -tcp 0 0 localhost:submission *:* LISTEN -tcp 0 0 *:netbios-ssn *:* LISTEN -tcp 0 0 *:www *:* LISTEN -tcp 0 0 *:50001 *:* LISTEN -tcp 0 0 *:ssh *:* LISTEN -tcp 0 0 localhost:ipp *:* LISTEN -tcp 0 0 localhost:smtp *:* LISTEN -...
kill
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
使用man kill可以取得详细说明
- 如何在Window或Linux/Unix中查找并干掉占用指定端口的进程
- Linux查找占用的端口,并杀死进程
- Linux查找占用的端口,并杀死进程
- Linux查找占用的端口,并杀死进程
- Linux查找占用的端口,并杀死进程
- 在windows系统的cmd窗口中命令查询指定端口占用的进程并关闭
- 如何在Windows中查找并端口占用和释放端口占用?
- window如何杀死占用端口的进程
- window下找查找占用端口的进程并手动杀死
- Windos如何查看端口占用并关闭指定进程
- 用Linux命令查看当前某个进程A,并查找该进程所占用的端口
- windows下DOS命令查找占用的端口,并通过端口寻找占用端口的进程
- window 查看端口占用进程 并杀死
- Linux或Unix下如何查看DB2所占用的端口号
- 查找并杀死占用某端口的进程
- Window 查指定端口并杀进程
- Linux 如何定位占用进程并杀掉占用端口号进程
- 如何找到占用端口的进程并关闭
- 方案schemas
- 嵌入式防火墙
- Java学习路线图
- 移植Boa Web服务器到ARM-Linux系统
- SQLSERVER 分页
- 如何在Window或Linux/Unix中查找并干掉占用指定端口的进程
- 对QQ抓包的临时记录
- 多线程学习(1)
- Vs快捷键一览表
- 多线程编程之二——MFC中的多线程开发
- SilverLight中ImageButton控件制作方法
- making things move as3 阅读笔记---绘图API
- 多线程编程之三——线程间通讯
- Delphi 中Md5获取(Indy 9)