Files
kenaito-kopsc/README.pkg.md
T
odboy 06a77b9507 docs: 补全命令说明并把 README 按模块拆分
- Docker 命令表由纯名称列表改为「命令 / 作用 / 实际执行」三列,
  覆盖全部 33 条;补充顶部示例与选项解析的例外说明
- 新增 pkg.refreshindex 独立小节
- 按命令分组拆出 README.docker/net/disk/diagnose/proc/pkg.md,
  主 README 保留简介、用法速览与「命令一览」导航表
- 新增「文档要写在哪」小节,约定后续新增命令的文档归属
2026-11-01 08:54:13 +08:00

37 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 系统软件包(`kopsc pkg <子命令>`)
> 返回 [README.md](README.md)
刷新系统包管理器的软件源索引。
```bash
kopsc pkg refreshindex # 刷新包管理器索引(dnf/apt/apk/brew/winget,按平台自动选)
```
## 刷新软件源索引(pkg.refreshindex)
`kopsc pkg refreshindex` 刷新本机包管理器的软件源索引,**只更新索引,不升级也不安装任何软件包**。
常用于「刚换完源 / 报错说找不到某个包」时先同步一次。
```bash
kopsc pkg refreshindex # 按当前平台自动选择:
# Linux centos → dnf makecache
# Linux ID_LIKE rhel/fedora → dnf makecache
# Linux ID_LIKE debian/ubuntu → apt-get update
# Linux alpine → apk update
# macOS → brew update
# Windows → winget source update
```
| 平台 | 实际执行 |
| --- | --- |
| Linux(`/etc/os-release` 的 `ID=centos`) | `dnf makecache` |
| Linux(`ID_LIKE` 含 rhel / fedora) | `dnf makecache` |
| Linux(`ID_LIKE` 含 debian / ubuntu) | `apt-get update` |
| Linux(`ID=alpine`) | `apk update` |
| macOS | `brew update` |
| Windows | `winget source update` |
- 需要相应包管理器的权限时(如 `apt-get update`),请以 root / sudo 运行 kopsc。
- 更新索引本身不改动已安装的软件;要升级请用系统自带的包管理器命令。