Linux for Developers Course
Linux for Developers
/
Intermediate

netstat

Definition

Network Statistics. A classic command-line tool that displays network connections, routing tables, and a number of network interface statistics.

Explain Like I'm New

The traffic camera. It shows you exactly which ports on your computer are open and listening, and exactly who is currently connected to them.

Real World Example

You start a database, but it crashes saying 'Port already in use'. You type `netstat -tulnp`. It reveals that a forgotten Python script is already secretly running on port 3306.

Common Use Cases

  • •Port checking
  • •Security auditing (finding rogue connections)

Interview Questions

basic

  • Is `netstat` considered a modern, actively updated command?

intermediate

  • In `netstat -tulnp`, what does the 'l' stand for?

Flash Cards

Question

Modern command?

Click to reveal answer
Answer

No. `netstat` is considered deprecated in modern Linux, though it is still widely used out of habit. The modern replacement is the `ss` command.

Question

What is 'l'?

Click to reveal answer
Answer

Listening. It filters the output to ONLY show ports that are actively waiting for an incoming connection, hiding established outbound connections.