Linux check port command

On Linux systems, you can use the following command to check the status of the port:

1. Netstat command:
   - `netstat -tuln`: List the currently listening TCP and UDP ports.
   - `netstat -tuln | grep <port number>`: Find out if the specified port number is listening.

2. ss command:
   - `ss -tuln`: Display the currently listening TCP and UDP ports.
   - `ss -tuln | grep <port number>`: Find if the specified port number is listening.

3. lsof command:
   - `lsof -i :<port number>`: View the related processes and applications of the specified port number.

4. nmap command:
   - `nmap -p <port number> <IP address>`: perform a port scan on the specified IP address, and check whether the specified port is open.

Please replace `<port number>` and `<IP address>` with the port number and corresponding IP address you want to check. If the IP address is omitted, the above command will look at the ports that are currently listening on the host.

The above commands can help you check the status and progress of the ports for network troubleshooting or listening for network connections. When executing these commands, you need to have appropriate permissions, such as using an administrator or root user to execute.

Guess you like

Origin blog.csdn.net/wangqiaowq/article/details/131805021