DEV Community

Faruk
Faruk

Posted on • Originally published at Medium

How I Use netstat and ss to Catch Suspicious Connections on Linux | by Faruk Ahmed | Jul, 2025

Member-only story

How I Use netstat and ss to Catch Suspicious Connections on Linux

--

Share

Intro: Sometimes the biggest threats to your Linux server aren’t in the logs — they’re quietly hiding in plain sight, listening on open ports or making outbound connections you didn’t authorize. This post explains how I use netstat and ss to find those sneaky processes and shut them down before they become a real problem.

🔍 1. The Threat: Undetected Network Activity

Most malware and unauthorized scripts “call home” or open ports to accept commands. If you’re not checking for this regularly, you’re trusting every connection your server makes.

⚙️ 2. Install net-tools and Use netstat

On older systems or for familiarity:

# Debian/Ubuntu:sudo apt install net-tools
Enter fullscreen mode Exit fullscreen mode
# Red Hat/CentOS:sudo yum install net-tools
Enter fullscreen mode Exit fullscreen mode

Check all listening ports:

sudo netstat -tulnp
Enter fullscreen mode Exit fullscreen mode

This lists:

  • Protocol (tcp, udp)
  • Local address/port
  • PID/Program name

🚀 3. Use ss for Faster and Modern Analysis


👉 Read Full Blog on Medium Here

Launch embedded dashboards in 10% of the time - with 100% of your standards.

Launch embedded dashboards in 10% of the time - with 100% of your standards.

Embed in minutes, load in milliseconds, extend infinitely. Import any chart, connect to any database, embed anywhere. Scale elegantly, monitor effortlessly, CI/CD & version control.

Get early access

Top comments (0)

Heroku

Build AI apps faster with Heroku.

Heroku makes it easy to build with AI, without the complexity of managing your own AI services. Access leading AI models and build faster with Managed Inference and Agents, and extend your AI with MCP.

Get Started

👋 Kindness is contagious

Delve into this thought-provoking piece, celebrated by the DEV Community. Coders from every walk are invited to share their insights and strengthen our collective intelligence.

A heartfelt “thank you” can transform someone’s day—leave yours in the comments!

On DEV, knowledge sharing paves our journey and forges strong connections. Found this helpful? A simple thanks to the author means so much.

Get Started