# A15 环境感知 C1 单工具 R0 只读 Port Checker

> 检查端口占用情况、识别占用进程、排查端口冲突。适用场景：(1) 端口被占用需找出进程，(2) 查看所有监听端口，(3) 检查某服务是否在运行。触发词：'端口'、'port'、'占用'、'监听'、'netstat'、'lsof'。不适用：防火墙规则管理（用 iptables/ufw）、网络流量分析（用 tcpdump/wireshark）。

- **Type:** Skill
- **Install:** `agentstack add skill-leisvip-agent-skill-taxonomy-a15-c1-r0-port-checker`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [leisvip](https://agentstack.voostack.com/s/leisvip)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [leisvip](https://github.com/leisvip)
- **Source:** https://github.com/leisvip/agent-skill-taxonomy/tree/main/skills/A15-环境感知_C1-单工具_R0-只读_port-checker

## Install

```sh
agentstack add skill-leisvip-agent-skill-taxonomy-a15-c1-r0-port-checker
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# port-checker

快速排查端口占用和网络监听情况。

## 配置（首次）

无需配置。

## 常用命令

### 查看所有监听端口

```bash
ss -tlnp
```

### 查看指定端口是否被占用

```bash
ss -tlnp | grep :
# 示例：ss -tlnp | grep :8080
```

### 查找占用指定端口的进程

```bash
# Linux
ss -tlnp | grep :

# 通用（需 root 权限查看所有进程）
lsof -i :
```

### 查看某进程监听的所有端口

```bash
lsof -i -P -n | grep 
```

### 查看所有 ESTABLISHED 连接

```bash
ss -tnp state established
```

### 查看 TCP 和 UDP 全部端口

```bash
ss -tulnp
```

### 统计各状态连接数

```bash
ss -tan | awk '{print $1}' | sort | uniq -c | sort -rn
```

### 检查远程端口是否可达

```bash
# 使用 ss 检查（仅本地）
ss -tn dst :

# 使用 timeout 检查远程连通性
timeout 3 bash -c "echo >/dev/tcp//" 2>/dev/null && echo "✅ 可达" || echo "❌ 不可达"
```

## 注意事项

- `ss -p` 显示进程信息需要 root 权限，普通用户只能看到自己的进程
- macOS 上 `ss` 可能不可用，用 `lsof -i -P -n` 替代
- `lsof` 不在所有系统默认安装，缺失时用 `ss` 或 `netstat` 替代
- 容器内看到的端口映射可能与宿主机不同，需在宿主机上检查

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [leisvip](https://github.com/leisvip)
- **Source:** [leisvip/agent-skill-taxonomy](https://github.com/leisvip/agent-skill-taxonomy)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-leisvip-agent-skill-taxonomy-a15-c1-r0-port-checker
- Seller: https://agentstack.voostack.com/s/leisvip
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
