Midnight Commander: Console File Manager for Linux
In this article
Yes, Midnight Commander is a console-based file manager for Linux (and other Unix-like systems). It provides a text-mode, two-panel interface for browsing, copying, moving, and managing files directly from a terminal, making it a powerful tool for both remote and local file operations.
What Is Midnight Commander?
Midnight Commander (often abbreviated as mc) is a free, open-source file manager that runs entirely within a text terminal. It was first released in 1994 by Miguel de Icaza, and it has remained a staple in the Unix/Linux world ever since. Its design is inspired by the classic Norton Commander for DOS, which popularized the two-panel layout. This layout shows two directory listings side by side, allowing users to easily copy or move files between them.
Because it is a console application, it works over SSH sessions, on machines without a graphical desktop, and in minimal recovery environments. It does not require a mouse (though it can be used with one in some terminals), and it is lightweight enough to run on very old or resource-constrained hardware.
How Does Midnight Commander Work?
When you launch mc in a terminal, you are greeted with a full-screen interface divided into two main panels. Each panel displays the contents of a directory. The active panel (where the cursor is) is highlighted, and the other panel shows a different directory, often the destination for file operations.
- Function keys: F1–F10 provide quick access to help, menu, view, edit, copy, rename/move, make directory, delete, and quit.
- Tab key: Switches the active panel between left and right.
- Arrow keys: Navigate through files and directories.
- Enter: Opens a file or enters a directory.
- F3: Views the contents of a file without opening an editor.
- F4: Opens the file in the built-in editor (or an external editor if configured).
- F5: Copies the selected file(s) to the other panel's directory.
- F6: Renames or moves the selected file(s).
- F7: Creates a new directory.
- F8: Deletes the selected file(s).
You can also type commands at the bottom of the screen, which acts as a command line. This allows you to run any shell command without leaving the interface. Midnight Commander also supports a chroot mode (via the mc -c option) and can be used as a file viewer for many formats, including archives, by using the mcview command.
Why Use Midnight Commander Today?
With modern graphical file managers like Nautilus, Dolphin, or Thunar, you might wonder why anyone would use a text-based tool. Here are several compelling reasons:
- Remote server management: When you SSH into a server, you often have no graphical environment. Midnight Commander gives you a full-featured file manager over that connection.
- Speed and efficiency: For repetitive tasks like copying files between directories, the two-panel layout and keyboard shortcuts are often faster than dragging and dropping with a mouse.
- Lightweight: It uses very little memory and CPU, making it ideal for older machines or minimal installations.
- Scripting and automation: You can use
mcin scripts or combine it with other terminal tools. - Consistency: The interface works the same over any terminal, whether it's a local console, an SSH session, or a serial connection.
How to Install and Start Midnight Commander
Midnight Commander is included in the package repositories of most Linux distributions. Installation is straightforward:
- Debian/Ubuntu:
sudo apt install mc - Fedora:
sudo dnf install mc - Arch Linux:
sudo pacman -S mc - openSUSE:
sudo zypper install mc
After installation, simply type mc in your terminal and press Enter. The interface will appear. To exit, press F10 or Ctrl+O (which toggles the interface and shows the underlying shell).
Common Problems and Solutions
While Midnight Commander is generally stable, users may encounter a few common issues:
- Mouse not working: If your terminal doesn't support mouse reporting, you can enable it in the options (Options → General → Mouse support) or use the keyboard exclusively.
- Display issues over SSH: If the interface looks garbled, ensure your terminal supports the required escape sequences. Using a modern terminal emulator like GNOME Terminal, Konsole, or PuTTY usually resolves this.
- File permissions: If you cannot delete or modify files, you may need to run
mcwithsudo(though be cautious, as this gives full access). - Editor not launching: By default, F4 opens the internal editor. If you prefer an external editor like vim, you can change it in the Options → Configuration → Editor.
Midnight Commander vs. Other Terminal File Managers
Midnight Commander is not the only terminal-based file manager. Others include ranger, vifm, and nnn. Here's a quick comparison:
- ranger: Uses a three-pane layout and is highly extensible with Python. It has a steep learning curve but offers powerful previews and file handling.
- vifm: Designed for Vim users, with vi-like keybindings and a two-pane layout. It integrates well with Vim's editing capabilities.
- nnn: Extremely lightweight and fast, with a focus on minimalism and keyboard efficiency. It lacks some of the built-in features of MC, like an editor.
Midnight Commander stands out for its simplicity, built-in editor, and broad feature set. It is often the default choice for users who want a reliable, no-frills file manager that works everywhere.
Cost, License, and Safety
Midnight Commander is completely free and open-source, distributed under the GNU General Public License (GPL). You can use, modify, and distribute it without cost. It is a mature project with a long history, and it is widely considered safe and stable. However, as with any file manager, exercise caution when deleting or moving files, especially with sudo, as mistakes can be irreversible. Always double-check the source and destination directories before performing bulk operations.
Frequently Asked Questions
Can I use Midnight Commander on Windows?
Yes, you can run Midnight Commander on Windows through the Windows Subsystem for Linux (WSL) or by using a terminal emulator like Cygwin. It is not a native Windows application, but it works well in these environments.
Does Midnight Commander support drag-and-drop?
No, Midnight Commander is a keyboard-driven application. While some terminals allow mouse interaction, the primary interface is designed for keyboard shortcuts. This is a deliberate design choice for efficiency and consistency.
Can I customize the look of Midnight Commander?
Yes, you can customize colors, keybindings, and the default editor through the Options menu. Configuration files are stored in ~/.config/mc/ and ~/.mc/. You can also create custom menu entries and file associations.
How do I copy files between two remote servers with Midnight Commander?
Midnight Commander can work with virtual file systems (VFS) to access remote servers via FTP, SFTP, or SMB. You can navigate to ftp://user@host or sftp://user@host in a panel and then copy files between that remote location and your local filesystem.
Is Midnight Commander still maintained?
Yes, Midnight Commander is actively maintained. The latest stable release is regularly updated, and the project has a dedicated development community. You can find the source code and releases on GitHub.
What is the difference between Midnight Commander and a regular terminal?
A regular terminal is just a shell prompt where you type commands. Midnight Commander is a full-screen application that runs inside that terminal, providing a visual file manager with panels, menus, and function keys. It is not a shell itself; it uses the shell for command execution.