On Linux systems, you can use the command-line tools `netstat` or `lsof` to check which ports are currently in use.
Use the `netstat` command to check port usage:
netstat -tunlpThis command lists all TCP and UDP ports along with their corresponding process information. The options include: -t for TCP connections, -u for UDP connections, -n to avoid resolving service or host names, -l to display only ports that are listening, and-p to show the process ID and name.
Use the `lsof` command to check port usage:
lsof -i :端口号This command lists information about the processes using the specified port; the `-i` option refers to the file descriptor of the network connection, and the `:port` parameter must be replaced with the actual port number.
Please note that on certain Linux distributions, these tools may require root privileges to function properly.