# Netstat

![](https://i.imgur.com/MHpXCfP.png)

> The Network statistics tool

Netstat (Network Statistics) é uma ferramenta utilizada para monitorar redes e, como o próprio nome diz, gerar estatísticas.

Algumas informacoes que conseguimos obter com o netstat são, por exemplo, quais portas de comunicacão TCP e UDP estão abertas na nossa maquina e quais os programas ouvindo nessas portas.

## Funcionamento básico

`$ netstat -a` Lista todas as conexões e portas abertas.

`$ netstat -at` Aplica um filtro (-t) no comando anterior, listando apenas as portas TCP.

`$ netstat -au` Aplica um filtro (-u) , listando apenas as portas UDP.

`$ netstat -atp` Com o acréssimo do p mostra também o programa que está sendo executado em cada porta.

## Gerando Estatísticas sobre a rede

`$ netstat -i` Para obter informações de uso das interfaces de rede.

`$ netstat -ie` Para detalhar ainda mais as informações mostradas

`$ netstat -s` Para obter estatísticas resumidas de cada um dos protocolos de rede (por exemplo, TCP, UDP, ICMP).

`$ netstat -rn` Para visualizar a tabela de routing da máquina.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gitbook.ganeshicmc.com/redes/ferramentas/netstat.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
