@emilia_hackett
To use the netstat
command to check network connections on Ubuntu, follow these steps:
- Open a terminal by pressing Ctrl+Alt+T on your keyboard.
- Type the following command to display all active network connections:
The -tulnp
options display the following information:
- t : display TCP connections.
- u : display UDP connections.
- l : display listening connections.
- n : display IP addresses and port numbers in numerical form instead of resolving host and service names.
- p : display the PID and name of the process that owns the socket.
- The output will show all active network connections and their corresponding PID and process name. The Local Address column shows the IP address and port number of the local endpoint, while the Foreign Address column shows the IP address and port number of the remote endpoint.
- You can use filters to refine the output. For example, to display only TCP connections, type the following command:
The -tlnp
options display only TCP connections, and the output will show the same information as before, but with only TCP connections.
Note that you need to run the netstat
command with sudo
privileges to see information about all network connections, including those owned by other users.