# Сетевые порты

## Список открытых портов

```
$ sudo ss -tulpn
$ sudo netstat -tulpn

для просмотра портов TCP и UDP в режиме реального времени нужно запустить netstat или ss с помощью утилиты watch. 
$ sudo watch netstat -tulpn
Или
$ sudo watch ss -tulpn
```

## Освободить ранее занятые порт

Эта команда заставляет систему освобождать ранее забинженый порт через 1 секунду. Часто по-умолчанию стоит значение 60, т.е. ждать целую минуту:

```
echo 1 > /proc/sys/net/ipv4/tcp_fin_timeout
```


---

# 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://appsecurity.gitbook.io/devops/operacionnye-sistemy/linux/cases/spisok-otkrytykh-portov.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.
