> For the complete documentation index, see [llms.txt](https://krjaeh0.gitbook.io/j-log/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://krjaeh0.gitbook.io/j-log/network/tools-and-operations/netstat.md).

# netstat

{% hint style="info" %}
네트워크 상태를 모니터링하고 분석하는 데 사용되는 툴\
주로 네트워크 연결, 라우팅 테이블, 인터페이스 통계 및 기타 네트워크 관련 정보를 표시하는 데 사용된다.
{% endhint %}

```bash
dnf install -y net-tools
```

| 옵션  | 설명                                     |
| --- | -------------------------------------- |
| -a  | 현재 시스템에서 모든 연결과 청취 포트를 보여준다.           |
| -at | TCP 프로토콜을 사용하는 모든 포트를 나열               |
| -au | UDP 프로토콜을 사용하는 모든 포트를 나열               |
| -l  | 청취 상태인 포트만 보여준다.                       |
| -lt | TCP 청취 포트만 나열                          |
| -lu | UDP 청취 포트만 나열                          |
| -s  | 프로토콜별 통계 표시                            |
| -st | TCP 통계만 표시                             |
| -su | UDP 통계만 표시                             |
| -i  | 네트워크 인터페이스 통계 표시                       |
| -ie | 네트워크 인터페이스 통계의 더 자세한 정보 표시             |
| -p  | 각 연결에 관련된 프로세스 ID(PID)와 프로그램 이름을 표시한다. |
| -r  | 커널의 IP 라우팅 테이블을 표시                     |

#### 추가 정보 및 대안 도구

* **`ss` 명령어**: `netstat`의 현대적 대체 도구로, 더 빠르고 자세한 정보를 제공해.

```bash
ss -t
```

이 명령어는 모든 TCP 연결을 보여줘.

* **`ip` 명령어**: 라우팅, 디바이스 관리, 정책 라우팅 및 터널을 조작하는 데 사용돼.

```bash
ip route
```

이 명령어는 시스템의 IP 라우팅 테이블을 보여줘.

* **`nmap` 명령어**: 네트워크 검색 및 보안 감사 도구로, 시스템에서 열려 있는 포트를 스캔할 수 있어.

```bash
nmap localhost
```

이 명령어는 로컬 머신의 열려 있는 포트를 스캔해.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://krjaeh0.gitbook.io/j-log/network/tools-and-operations/netstat.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
