SIGN IN SIGN UP
Fechin / reference UNCLAIMED

⭕ Share quick reference cheat sheet for developers.

0 0 1 EJS
2021-02-05 11:24:59 +08:00
---
title: Netstat
2021-02-09 10:36:13 +08:00
date: 2021-01-27 11:44:21
2021-12-17 12:23:07 +08:00
background: bg-slate-700
2021-02-05 11:24:59 +08:00
tags:
- network
- utility
- port
2021-02-05 11:24:59 +08:00
categories:
- Linux Command
2021-02-05 11:24:59 +08:00
intro: |
This quick reference cheat sheet provides various for using netstat command.
2023-03-06 16:19:19 +08:00
plugins:
- copyCode
2021-02-05 11:24:59 +08:00
---
## Getting Started
2021-02-05 11:24:59 +08:00
### Statistics
All connections on port 80
2021-02-05 11:24:59 +08:00
```shell script
$ netstat -anp | grep :80
```
2021-02-05 11:24:59 +08:00
Netstat Help
2021-02-05 11:24:59 +08:00
```shell script
$ netstat -h
```
### Listening
2021-09-14 13:03:55 +08:00
| Option | Example |
| ---------------- | -------------------- |
2021-02-05 11:24:59 +08:00
| `netstat -ltunp` | All Listening ports |
2021-09-14 13:03:55 +08:00
| `netstat -ltn` | Listening TCP ports |
| `netstat -lun` | Listening UDP ports |
| `netstat -lx` | Listening Unix ports |
2021-02-05 11:24:59 +08:00
### Connections
2021-09-14 13:03:55 +08:00
| Option | Example |
| ------------- | ------------------- |
2021-09-14 13:03:55 +08:00
| `netstat -a` | All connections |
| `netstat -at` | All TCP connections |
| `netstat -au` | All UDP connections |
2021-02-05 11:24:59 +08:00
### Statistics
2021-09-14 13:03:55 +08:00
| Option | Example |
| ------------- | ---------------------- |
2021-09-14 13:03:55 +08:00
| `netstat -s` | Display statistics |
| `netstat -st` | Display TCP statistics |
| `netstat -su` | Display UDP statistics |
2021-02-05 11:24:59 +08:00
### Networks
2021-09-14 13:03:55 +08:00
| Option | Example |
| ------------- | ------------------------------------- |
2021-09-14 13:03:55 +08:00
| `netstat -i` | Show network interfaces |
| `netstat -ie` | Show network interfaces extended info |
2021-02-05 11:24:59 +08:00
### Routing
2021-09-14 13:03:55 +08:00
| Option | Example |
| ------------- | --------------------------------------- |
2021-09-14 13:03:55 +08:00
| `netstat -r` | Show routing table |
| `netstat -rn` | Show routing table, don't resolve hosts |