Overview
Midnight Commander (mc) is a full-featured, visual terminal file manager with a classic two-panel interface inspired by Norton Commander. It provides an intuitive text-based GUI for file management, including copying, moving, renaming, searching, and editing files. MC includes a built-in text editor (mcedit), file viewer (mcview), and supports virtual filesystems for browsing archives, FTP, SFTP, and SMB shares.
MC runs on Linux, macOS, and other Unix-like systems. It is particularly popular among system administrators for its ability to manage files on remote servers over SSH without a graphical environment. Its two-panel design makes comparing directories and moving files between locations efficient and straightforward.
Installation
# Ubuntu/Debian
sudo apt install mc
# macOS
brew install midnight-commander
# Arch Linux
sudo pacman -S mc
# Fedora
sudo dnf install mc
# CentOS/RHEL
sudo yum install mc
# openSUSE
sudo zypper install mc
# Alpine
apk add mc
# Start Midnight Commander
mc
Core Key Bindings
Panel Navigation
| Key | Action |
|---|
Tab | Switch between panels |
Up/Down | Navigate files |
Enter | Open directory / execute file |
Home | Go to first file |
End | Go to last file |
Page Up | Scroll up one page |
Page Down | Scroll down one page |
Alt+O | Load current dir in other panel |
Alt+I | Make other panel same as current |
Ctrl+\ | Show directory hotlist |
Alt+Y | Previous directory in history |
Alt+U | Next directory in history |
Function Keys
| Key | Action |
|---|
F1 | Help |
F2 | User menu |
F3 | View file |
F4 | Edit file |
F5 | Copy |
F6 | Move/Rename |
F7 | Create directory |
F8 | Delete |
F9 | Pull-down menus |
F10 | Quit |
File Selection
| Key | Action |
|---|
Insert | Select/deselect file |
+ (Plus) | Select by pattern |
- (Minus) | Unselect by pattern |
* (Star) | Invert selection |
Ctrl+T | Select current file |
Quick Navigation
| Key | Action |
|---|
Alt+C | Quick cd dialog |
Ctrl+\ | Directory hotlist |
Alt+H | Directory history |
Alt+Shift+H | Command history |
Ctrl+S | Quick search |
Alt+S | Quick search (case-insensitive) |
File Operations
# Copy files (F5)
# 1. Select files with Insert or + pattern
# 2. Press F5
# 3. Confirm destination (other panel by default)
# Move/Rename (F6)
# 1. Select files
# 2. Press F6
# 3. Edit destination path or new name
# Delete (F8)
# 1. Select files
# 2. Press F8
# 3. Confirm deletion
# Create directory (F7)
# 1. Press F7
# 2. Enter directory name
# Change permissions
# 1. Select file(s)
# 2. Go to File menu (F9 > File)
# 3. Select "Chmod" or "Chown"
Built-in Editor (mcedit)
# Open editor standalone
mcedit filename.txt
# Or press F4 on a file in MC
# Editor key bindings:
# F2 Save
# F10 Quit
# F3 Mark block start
# F5 Copy block
# F6 Move block
# F8 Delete block
# Ctrl+Y Delete line
# Ctrl+U Undo
# Ctrl+S Search
# Ctrl+T Search and replace
# F7 Search
# Shift+F7 Search again
# F17 Replace
# Ctrl+N New file
# F2 Save
# Shift+F2 Save as
Built-in Viewer (mcview)
# Open viewer standalone
mcview filename.txt
# Or press F3 on a file in MC
# Viewer key bindings:
# F2 Toggle wrap
# F4 Toggle hex mode
# F7 Search
# F8 Toggle raw/parsed
# Shift+F7 Search again
# q Quit
Virtual Filesystems
# FTP access
# In the command line or Alt+C:
cd ftp://user:password@ftp.example.com/path
# SFTP/SSH access
cd sh://user@server.example.com/path
# Browse archives as directories
# Navigate to a .tar.gz, .zip, .rpm, etc. and press Enter
# SMB access (if smbfs is available)
cd smb://server/share
# Access ISO files
cd iso9660://image.iso
Panel Modes
| Key | Description |
|---|
Alt+, | Switch panel layout mode |
Ctrl+X, L | Create symlink |
Ctrl+X, S | Edit symlink |
Panel Display Options (F9 > Left/Right)
- File listing mode: Full, Brief, Long, Custom
- Sort order: Name, Extension, Size, Time, Unsorted
- Filter: Show only matching files
- Encoding: Set character encoding
Search (Alt+?)
# Search for files
# 1. Press Alt+? (or Command > Find file)
# 2. Enter search pattern (supports wildcards)
# 3. Optionally enter content search string
# 4. Set search directory
# 5. Navigate results in panel
# Quick search in current panel
# Ctrl+S then start typing
# Alt+S for case-insensitive
# Create custom menu entries
# Edit ~/.config/mc/menu or use F9 > Command > Edit menu file
# Example menu entries:
# a Compress current directory
# tar czf "../%d.tar.gz" .
#
# b Extract archive here
# tar xzf %f
#
# c Git status
# git status; read -p "Press Enter"
#
# d Docker ps
# docker ps; read -p "Press Enter"
Configuration
# Configuration files location
~/.config/mc/ini # Main configuration
~/.config/mc/panels.ini # Panel settings
~/.config/mc/hotlist # Directory hotlist
~/.config/mc/menu # User menu
~/.config/mc/mc.ext # File associations
~/.local/share/mc/skins/ # Custom skins
# Access settings
# F9 > Options > Configuration
# F9 > Options > Layout
# F9 > Options > Panel options
# F9 > Options > Appearance (skins)
File Associations (mc.ext)
# ~/.config/mc/mc.ext.ini
# Define how files are opened
[pdf]
Type=^PDF
Open=zathura %f &
View=pdftotext %f -
[image]
Regex=\.(png|jpg|jpeg|gif|bmp|webp)$
Open=sxiv %f &
View=chafa %f
[video]
Regex=\.(mp4|mkv|avi|mov|webm)$
Open=mpv %f &
Advanced Usage
Subshell
# MC includes an embedded subshell
# Ctrl+O Toggle between MC and subshell
# Commands typed in the bottom panel run in the subshell
# The shell shares the current directory with MC
# Use %f for current file, %d for current directory
# Example: grep -r "pattern" %d
Directory Hotlist
# Ctrl+\ Open hotlist
# Add current directory to hotlist from menu
# Or edit ~/.config/mc/hotlist directly
# hotlist format:
# ENTRY "/home/user/projects" "Projects"
# ENTRY "/var/log" "Logs"
# ENTRY "/etc" "Config"
Panel Comparison
# Compare directories
# F9 > Command > Compare directories
# Compare files
# Select a file in each panel
# F9 > Command > Compare files
Command Line Integration
# mc passes selected file to command line
# Alt+Enter Insert current filename to command line
# Ctrl+Enter Insert current filename to command line
# Alt+A Insert current directory to command line
# Run command on selected files
# Type command in bottom prompt using %f, %d macros
Skins
# List available skins
ls /usr/share/mc/skins/
# Set skin via command line
mc --skin=gotar
# Set in configuration
# F9 > Options > Appearance
# Or edit ~/.config/mc/ini:
# [Midnight-Commander]
# skin=gotar
Troubleshooting
| Issue | Solution |
|---|
| Function keys not working | Check terminal emulator key mapping; try ESC+number |
| Colors wrong | Set TERM=xterm-256color; try different skin |
| Mouse not working | Enable mouse in Options > Configuration; check terminal |
| SFTP connection fails | Verify SSH config; check mc has SSH access |
| Editor opens wrong program | Set $EDITOR or configure in Options > Configuration |
| Archives not opening | Install required tools (unzip, unrar, p7zip) |
| Slow on remote filesystems | Use SFTP instead of FISH; reduce panel refresh |
| UTF-8 characters broken | Set correct locale; verify terminal UTF-8 support |