Find the process talking to that remote server
Networking & Firewall (Ss/Netstat/Iptables/Nftables/Curl)
Find the process talking to that remote server
🧩 The Challenge
You’ve got a server that’s supposed to be talking to some remote endpoint—maybe an external database, a critical API, or even another microservice—but you’re flying blind. You don’t know *which* local process is actually initiating those connections. And let’s be real, trying to sift through `netstat` output on a busy server is just painful; it’s slow and dumps a ton of garbage you don’t care about.
💡 The Fix
Forget `netstat`. `ss` is your friend here. A quick one-liner lets you instantly filter for established outgoing connections to a specific remote IP or hostname, showing you the local process ID and name doing all the work. It’ll save you minutes, if not hours, of frustrating guesswork.
ss -tnap state established dst REMOTE_IP_OR_HOSTNAME
# Example: ss -tnap state established dst 10.0.0.5
# Or to a specific hostname: ss -tnap state established dst api.example.com
# To also specify a remote port (e.g., HTTPS):
# ss -tnap state established dst REMOTE_IP_OR_HOSTNAME:443
⚙️ Why It Works
`ss` (socket statistics) is genuinely just a far superior, faster utility than `netstat` for this kind of thing. The `-t` shows TCP sockets, `-n` keeps things numeric, `-a` lists all, and `-p` adds the process info. And `state established` cuts out all the noise from listening ports or weird half-open stuff, letting you focus directly on active outbound connections to your `dst` target.
🚀 Pro-Tip: Need to see everything connecting out to *any* remote port 5432 (PostgreSQL)? Try `ss -tnap state established dport = :5432`.
Linux Tips & Tricks | © ngelinux.com | 11/24/2026
