# 午夜指挥官

**午夜指挥官**（通常简称 `mc`）是一款自由、全屏、文本模式的文件管理器与可视 shell，面向类 Unix 系统，围绕两个并排的目录面板构建。它基于 GNU 通用公共许可证发布，正式隶属于 GNU 计划，所有作者均已将其权利转让给[自由软件基金会](https://www.edgepedia.org/zh/free-software-foundation)。<sup>[1](https://midnight-commander.org/)</sup><sup> • </sup><sup>[2](https://github.com/MidnightCommander/mc/blob/master/doc/FAQ)</sup>

| 关键事实 | 详情 |
|---|---|
| 是什么 | 可视化的双面板文件管理器与可视 shell；可复制、移动、删除文件与目录树，搜索文件，并在子 shell 中运行命令<sup>[1](https://midnight-commander.org/)</sup> |
| 许可证 | GNU 通用公共许可证第 3 版或更高版本<sup>[3](https://github.com/MidnightCommander/mc/blob/master/doc/README)</sup><sup> • </sup><sup>[4](https://packages.fedoraproject.org/pkgs/mc/mc/)</sup> |
| 起源 | 最初构想为 John Socha 的 Norton Commander 的自由克隆；1994 年 10 月 29 日以“午夜指挥官”之名首次发布<sup>[3](https://github.com/MidnightCommander/mc/blob/master/doc/README)</sup><sup> • </sup><sup>[5](https://lists.midnight-commander.org/pipermail/mc-devel/2014-October/010589.html)</sup> |
| 虚拟文件系统 | 可像浏览本地目录一样浏览 tar、ar、rpm、zip、cpio、lha 和 rar 归档，以及通过 FTP、SFTP 或 shell 连接访问的远程系统<sup>[3](https://github.com/MidnightCommander/mc/blob/master/doc/README)</sup> |
| 子 shell | 可与 bash、tcsh 和 zsh 交互；ksh 等其他 shell 不支持子 shell 集成<sup>[2](https://github.com/MidnightCommander/mc/blob/master/doc/FAQ)</sup> |
| 平台 | 包括 GNU/Linux、FreeBSD、Mac OS X、Solaris 和 HP-UX 在内的 POSIX 系统；可在 Windows 上的 Cygwin 下编译<sup>[2](https://github.com/MidnightCommander/mc/blob/master/doc/FAQ)</sup> |
| 当前版本 | Fedora 稳定版仓库中为 4.8.33<sup>[4](https://packages.fedoraproject.org/pkgs/mc/mc/)</sup> |

## 界面与操作

屏幕分为两个目录面板、靠近底部的 shell 命令行、一行功能键标签，以及顶部菜单栏——菜单栏在鼠标点击或按下 F9 时出现。其中一个面板是当前面板，由选择条标出，几乎所有操作都作用于它；复制、重命名等操作默认以另一面板的目录为目标位置，并先请求确认。命令可直接在 shell 命令行输入并按回车执行，因此面板界面之外仍保留了 shell 的全部能力。<sup>[6](https://linux.die.net/man/1/mc)</sup>

程序内置查看器、编辑器和差异查看器。编辑器通过选中文件后按 F4 启动，具备语法高亮、宏、自动缩进，并可通过 libaspell 进行可选的拼写检查；查看器还支持十六进制模式。<sup>[1](https://midnight-commander.org/)</sup><sup> • </sup><sup>[3](https://github.com/MidnightCommander/mc/blob/master/doc/README)</sup><sup> • </sup><sup>[7](https://github.com/adamyg/mcwin32)</sup> 按 F1 可获取上下文相关的在线帮助，`mc`、`mcedit`、`mcview` 和 `mcdiff` 的手册页是主要的官方文档。<sup>[1](https://midnight-commander.org/)</sup>

**子 shell。** 按 Ctrl-O 可将面板切换隐藏，露出底层的 shell。此功能在子 shell 特性激活时可用，要求登录 shell 为 bash、tcsh 或 zsh；ksh 缺少子 shell 集成所需的钩子。在无法保存和恢复屏幕内容的终端上，Ctrl-O 仅在子 shell 下有效。<sup>[2](https://github.com/MidnightCommander/mc/blob/master/doc/FAQ)</sup>

## 虚拟文件系统

午夜指挥官的虚拟文件系统（VFS）层让不在本地磁盘上的数据也能像文件系统一样访问。进入 tar、cpio、rpm、deb 或 zip 等归档文件，或通过 FTP、SFTP 或 shell 连接到达的远程位置，都会将其作为可浏览的目录打开，几乎所有常规操作都能通过它完成；例如，用户可以查看存储在 FTP 服务器上的归档文件中的某个文件。<sup>[3](https://github.com/MidnightCommander/mc/blob/master/doc/README)</sup> 对 cpio、tar、FTP 和 shell 连接的 VFS 支持在构建时默认启用，SFTP 需要 libssh2 1.2.8 或更高版本。<sup>[8](https://github.com/MidnightCommander/mc/blob/master/doc/INSTALL)</sup> 该项目 2000 年的一篇 USENIX 论文将这一用户空间 VFS 库描述为通过扩展 URI 系统解决了对归档内及远程互联网站点上文件的访问问题。<sup>[9](https://www.usenix.org/event/usenix2000/freenix/full_papers/perazzoli/perazzoli.pdf)</sup>

## 历史

该程序始于 1990 年代初，当时墨西哥国立自治大学的数学系学生 [Miguel de Icaza](https://www.edgepedia.org/zh/miguel-de-icaza) 为他可使用的大学计算机编写了一款 [Norton Commander](https://www.edgepedia.org/zh/norton-commander) 风格的文件管理器。<sup>[10](https://www.mclibre.org/descargar/docs/revistas/alt-magazine/alt-magazine-2-es-200707.pdf)</sup> 1.0 版是首个以“午夜指挥官”之名发布的版本，于 1994 年 10 月 29 日发布。<sup>[5](https://lists.midnight-commander.org/pipermail/mc-devel/2014-October/010589.html)</sup> de Icaza 发布的 4.0 版公告列出了开发团队，包括 Andrej Borsenkow、Radek Doulik、Ching Hui 和 Jakub Jelinek。<sup>[11](https://groups.google.com/g/gnu.utils.bug/c/lwiEPzPheYI)</sup>

约 2000 年，GNU 午夜指挥官是 GNOME 项目的首选文件管理器。<sup>[9](https://www.usenix.org/event/usenix2000/freenix/full_papers/perazzoli/perazzoli.pdf)</sup> 此后该项目一直以志愿者方式延续；2014 年一封纪念二十周年的邮件列表帖子指出，该项目此前曾两度濒临消亡，而维护者的关注再次变得稀缺。<sup>[5](https://lists.midnight-commander.org/pipermail/mc-devel/2014-October/010589.html)</sup>

## 平台、依赖与安装

午夜指挥官运行于 POSIX 操作系统，包括 GNU/Linux、各 BSD、Mac OS X、Solaris 和 HP-UX，并可在 Windows 上的 Cygwin 下编译。它可在任何比哑终端更强的终端上工作，例如 vt100、Linux 或 FreeBSD 控制台、X Window 终端模拟器，以及 telnet 或 ssh 会话中。<sup>[2](https://github.com/MidnightCommander/mc/blob/master/doc/FAQ)</sup><sup> • </sup><sup>[3](https://github.com/MidnightCommander/mc/blob/master/doc/README)</sup> 其文本界面由 ncurses 或 S-Lang 绘制，需要 glib2 2.32 或更高版本；Linux 控制台上的鼠标支持使用 gpm 守护进程。<sup>[8](https://github.com/MidnightCommander/mc/blob/master/doc/INSTALL)</sup><sup> • </sup><sup>[2](https://github.com/MidnightCommander/mc/blob/master/doc/FAQ)</sup>

安装通过常规系统包管理器进行：Debian 和 Ubuntu 上为 `apt-get install mc`，Fedora 和 [Red Hat](https://www.edgepedia.org/zh/red-hat) 上为 `dnf install mc`，FreeBSD 上为 `pkg install mc`，OpenBSD 上为 `pkg_add mc`，macOS 上使用 Homebrew 或 MacPorts。源码发布由 OSU OSL 镜像，官方仓库托管在 GitHub 上。<sup>[1](https://midnight-commander.org/)</sup>

## 配置与可扩展性

用户设置位于 `~/.config/mc/` 下，包括用于通用选项的 `ini` 和用于面板状态的 `panels.ini`，默认遵循 XDG 惯例。<sup>[6](https://linux.die.net/man/1/mc)</sup><sup> • </sup><sup>[8](https://github.com/MidnightCommander/mc/blob/master/doc/INSTALL)</sup> F2 用户菜单完全可配置，可运行任意 shell 命令，外部面板化功能可将任意外部命令的输出显示在面板中。皮肤提供主题化，皮肤集合可在 skins.midnight-commander.org 获取。<sup>[2](https://github.com/MidnightCommander/mc/blob/master/doc/FAQ)</sup><sup> • </sup><sup>[1](https://midnight-commander.org/)</sup> 文件类型行为——例如哪种查看器或辅助程序打开 PDF、图像或压缩的手册页——在 `mc.ext.ini` 扩展文件中定义，该文件使用选中文件和标记文件的占位符将模式映射到命令。<sup>[12](https://github.com/MidnightCommander/mc/blob/master/misc/mc.ext.ini.in)</sup>

## 开发模式

项目主要通过邮件列表沟通，设有用户列表（`mc`）和开发者列表（`mc-devel`），另有 GitHub Discussions 和 GitHub 问题跟踪器。贡献者须根据开发者原创证书第 1.1 版在提交中签署 `Signed-off-by:` 行，这与 [Linux 内核](https://www.edgepedia.org/zh/linux-kernel)采用的方案相同，变更应附带测试。项目由志愿者维护，不提供商业级支持或担保。<sup>[13](https://midnight-commander.org/communication/)</sup><sup> • </sup><sup>[14](https://midnight-commander.org/source-code/)</sup>

## References

1. [Welcome to Midnight Commander, midnight-commander.org](https://midnight-commander.org/)
2. [mc/doc/FAQ, MidnightCommander/mc, GitHub](https://github.com/MidnightCommander/mc/blob/master/doc/FAQ)
3. [mc/doc/README, MidnightCommander/mc, GitHub](https://github.com/MidnightCommander/mc/blob/master/doc/README)
4. [mc - Fedora Packages](https://packages.fedoraproject.org/pkgs/mc/mc/)
5. [Happy 20th Birthday!, mc-devel mailing list, October 29, 2014](https://lists.midnight-commander.org/pipermail/mc-devel/2014-October/010589.html)
6. [mc(1): Visual shell for Unix-like systems, Linux man page](https://linux.die.net/man/1/mc)
7. [adamyg/mcwin32: Midnight Commander for Windows, GitHub](https://github.com/adamyg/mcwin32)
8. [mc/doc/INSTALL, MidnightCommander/mc, GitHub](https://github.com/MidnightCommander/mc/blob/master/doc/INSTALL)
9. [The GNU Midnight Commander, USENIX 2000 FREENIX track](https://www.usenix.org/event/usenix2000/freenix/full_papers/perazzoli/perazzoli.pdf)
10. [ALT Magazine no. 2 (2007), mclibre.org, on Miguel de Icaza and Midnight Commander](https://www.mclibre.org/descargar/docs/revistas/alt-magazine/alt-magazine-2-es-200707.pdf)
11. [Announcing the GNU Midnight Commander 4.0, gnu.utils.bug, Google Groups](https://groups.google.com/g/gnu.utils.bug/c/lwiEPzPheYI)
12. [mc/misc/mc.ext.ini.in, MidnightCommander/mc, GitHub](https://github.com/MidnightCommander/mc/blob/master/misc/mc.ext.ini.in)
13. [Communication, midnight-commander.org](https://midnight-commander.org/communication/)
14. [Source code, midnight-commander.org](https://midnight-commander.org/source-code/)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Application software by domain › Web browsers, clients, and user agents

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/midnight-commander

English original: https://www.edgepedia.org/midnight-commander
