Sockstat - Network Socket Statistics
View Listening Network Ports
The sockstat command is a powerful utility for inspecting network socket information on Unix-like systems. It allows you to see which processes are listening on which ports, and which connections are currently active. This is invaluable for network troubleshooting, security auditing, and understanding system resource usage.
To view which users and processes are listening on network ports, you can use the following command:
sudo sockstat -l
Understanding Sockstat Output
The output of sockstat -l typically includes details such as:
- User: The user account running the process.
- Protocol: The network protocol (e.g., TCP, UDP).
- Source Address: The local IP address and port.
- Destination Address: The remote IP address and port (often '*' for listening sockets).
- Process ID (PID): The unique identifier for the process.
- Command: The name of the executable running the process.
Key Use Cases for Sockstat
sockstat is particularly useful for:
- Identifying unexpected open ports that might indicate security vulnerabilities.
- Diagnosing network connectivity issues by seeing which services are running and listening.
- Monitoring resource usage by understanding which processes are consuming network sockets.
Further Exploration
For more advanced usage and options, consult the sockstat manual page. You can typically access it by running man sockstat in your terminal.
For related networking tools and concepts, you might find the following resources helpful: