In Linux generally use Netstat to view system port usage steps.
The netstat command is a very useful tool for monitoring the TCP/IP network, which shows the routing table, the actual network connection, and each network interface device's
The function of the netstat command is to display network connections, routing tables, and network interface information, allowing users to know what network connections are currently in operation.
The general format for this command is:
netstat [options]
The options in the command have the following meanings:
-a displays all sockets, including those that are listening.
-C is displayed again every 1 seconds until the user interrupts it.
-I displays information for all network interfaces in the form of "ifconfig-e".
-N Displays the network connection situation with the network IP address instead of the name.
-R Displays the core routing table in the same format as "Route-e".
-T displays the TCP protocol connection.
-U Displays the connection condition of the UDP protocol.
-V Displays the work in progress.
1. Netstat-an | grep LISTEN
0.0.0.0 is the service of each IP, which IP is the binding of the IP service.
2. Netstat-tln
Used to view the port usage of Linux
3./etc/init.d/vsftp Start
is used to start the FTP port ~!
4. Netstat
View the service ports that are already connected (established)
5. Netstat-a
View all service ports (listen,established)
6. Sudo netstat-ap
View all service ports and display the corresponding service program name
7. Nmap Scan type >< scan parameters
For example:
Nmap localhost
Nmap-p 1024-65535 localhost
Nmap-pt 192.168.1.127-245
When we look at a network connection using NETSTAT-APN, we find a lot of things like the following:
Proto recv-q Send-q Local address Foreign address State Pid/program Name
TCP 0 218.104.81.152:7710 211.100.39.250:29488 established 6111/1
Shows that this server is open to Port 7710, so which program does this port belong to? We can use the Lsof-i: 7710 command to query:
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
SSHD 1990 Root 3u IPv4 4836 TCP *:7710 (LISTEN) 54com.cn
So we know that port 7710 belongs to the SSHD program.
The above is a small set to introduce Linux with Netstat to view the status of the network, port status, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!