windows, linux, aix query which program the port number is occupied by

List of recent updates

1. Install jdk in IBM's aix (updated on July 21)
2. Install jdk in Linux (CentOS) (updated on July 21)
3. Install weblogic in Linux (CentOS) (updated on July 22)
4. Install webLogic in Aix system (Updated on July 22) 5.
Create a weblogic domain in IBM physical machine aix (updated on July 23 )
6. Create a weblogic domain through VNC in linux (updated on July 23)
7. Install Oracle 10g under RedHat 5 in detail (July 23 ) 24 update) 8. Linux starts oracle instance (July 24 update) 9. Create oracle instance and network monitoring through VNC in linux (July 25 update) 10. The method of closing ip6 in linux (July 25 update) 11. Jconsole , jvisualvm tool introduction 12. Soupui calls webservies help document 13. Loadrunner calls Webservice interface test optimization14. Loadrunner script reads XMl files 15. Remote Aix system using Xmanager 16. Xmanager graphical remote to aix system 17. Package common jar files The method of becoming an osgi bundle18. Code inspection specification Checkstyle configuration19. Webloigc 11g configuration cluster help document20. Activemq cluster configuration document













21. Apache2.2+tomcat6 cluster configuration
22. Modify the computer name to cause the oracle instance to fail to start the solution
23. Import the configuration required by the virtual machine with the oracle installer
24. Set the title for the tomcat and weblogic startup windows
25. Tomcat configuration Download server
26. Enable virtual machine hyper-v function under win8

27. windows, linux, aix query which program the port number is occupied by

28. Recursively change directory permissions under linux

29. Apache configuration virtual directory

 
1. In the Windows operating system, use the program to query port occupancy and clear port occupancy and

then use: netstat -b
or use

1. Query the process ID occupied by the port,

         click "Start" --> "Run", and enter "cmd" Then click the OK button to enter the DOS window, and then run the following commands:
netstat -a -n occupied by each port
netstat -ano occupied by each port and process PID
         netstat -aon | findstr "80"
     C:\Users\admin>netstat - aon|findstr "80"
  TCP 127.0.0.1:9080 0.0.0.0:0 LISTENING 4632

2. Check the application corresponding to the port number
       tasklist | findstr "4632"

      Supplement: tasklist /fi "pid eq 4632"
GROOVE.EXE 4632 Console 1 84,880 K
Obviously, GROOVE.EXE occupies port 80, and GROOVE.EXE is an IE ACTIVEX control.

3. Terminate the process
        taskkill /pid 4632 /F
     or use taskkill /f /t /im GROOVE.


    tasklist | findstr "4632"
If the execution command is terminated successfully, it should return empty ., it means success, and the process whose PID is 4632 is terminated. 2. In the Linux operating system, the program for querying

port occupation and clearing port occupation httpd 5014 root 3u IPv4 14346 TCP server2:http (LISTEN) 2. View the executable program corresponding to the process according to the process ID ps -f -p process ID # ps -f -p 5014 UID PID PPID C STIME TTY TIME CMD root 5014 1 0 17:26 ? 00:00:00 /usr/local/apache/bin/httpd -k 3. Check the dynamic link ldd executable file name according to the executable program ldd /usr/local/apache/bin/httpd         linux-vdso .so.1 => (0x00007fff9dc90000)
















        libaprutil-0.so.0 => /usr/local/apache/lib/libaprutil-0.so.0 (0x00002af026fcd000)  
4. Get the detailed information of the process occupied by the port number

netstat -tlnp|grep 80
tcp 0 0 192.168.33.10:80 0.0.0.0:* LISTEN 5014/httpd
tcp 0 0 0.0.0.0:48054 0.0.0.0:* LISTEN 5386/java

This step is equal to the above one or two steps

5. Query according to the port number, Query its occupied process ID

netstat -tlnp|grep 80|awk '{print $7}'|awk -F '/' '{print $1}'
5014
or use the following command

netstat -pan|grep 80

NETSTAT [-a ] [-b] [-e] [-n] [-o] [-p proto] [-r] [-s] [-v] [interval]
-a Show all connections and listening ports.
-b Displays the executables included in the creation of each connection or listening port. Executable components are known to have multiple independent components in some cases, and in these cases the sequence of components involved in creating a connection or listening port is displayed. In this case, the executable component name is in [] at the bottom, the component it calls at the top, and so on, up to the TCP/IP section. Note that this option may take a long time and may fail without sufficient permissions.              

-e Display ethernet statistics. This option can be combined with the -s option.                
-n Displays addresses and port numbers numerically.
-o Display the owning process ID associated with each connection.
-p proto Display connections for the protocol specified by proto; proto can be one of the following protocols: TCP, UDP, TCPv6, or UDPv6. If used with the -s option to display statistics by protocol, proto can be one of the following protocols: IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, or UDPv6.                
-r Display the routing table.
-s Display statistics by protocol. By default, statistics for IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, and UDPv6 are displayed; the
-p option is used to specify a subset of the default.                
-v When used with the -b option will display the components included in creating connections or listening ports for all executable components.                
interval Redisplays the selected statistics, pausing the interval (in seconds) between each display. Press CTRL+C to stop redisplaying statistics. If omitted, netstat will display the current configuration information (only once)

6. Clear the programs occupying port 80 at one time

lsof -i :80|grep -v "PID"|awk '{print "kill -9",$2}' |sh

7. Manually terminate the running of the process. If

kill 5014
cannot be terminated, you can forcefully terminate
kill -9 5014
lsof -i:80    

. The occupied process should not be queried.
3. AIX system query port number occupied

netstat -Aan| grep 80

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326995115&siteId=291194637