Networking & Firewall (Ss/Netstat/Iptables/Curl)
Stop getting burned by silent curl timeouts
🧩 The Challenge
You finally pushed that API integration to production only to find it hanging indefinitely because the remote server is a black hole. I’ve spent way too much time debugging hung processes that just sat there waiting for a TCP handshake that was never going to happen.
💡 The Fix
Slap some strict time limits on your requests so your scripts don’t just hang until the end of time. It forces the command to fail fast when the network starts acting up.
curl --connect-timeout 5 --max-time 10 https://api.example.com
⚙️ Why It Works
Setting the connect timeout handles the initial handshake phase, while max-time puts a hard cap on the entire transfer. Without these, your terminal ends up effectively dead until the kernel decides to give up, which takes forever.
🚀 Pro-Tip: Always include -f to make curl exit with an error code if the server returns a 4xx or 5xx, otherwise you’ll be debugging success stories that actually failed.
Linux Tips & Tricks | © ngelinux.com | 10/5/2026
