🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

Mastering Midnight Commander on AlmaLinux: The Ultimate File Manager Guide for System Administrators

Mastering Midnight Commander on AlmaLinux: The Ultimate File Manager Guide for System Administrators

If you have ever spent too long typing ls, cd, cp, and mv commands one after another, there is a better way. Midnight Commander (mc) is a powerful, text-based file manager that gives you a visual, two-panel interface right inside your terminal. Combined with AlmaLinux — the enterprise-grade, RHEL-compatible distribution trusted by thousands of production servers — it becomes an indispensable tool for any system administrator.

In this guide, we will cover everything from installation to advanced techniques, so you can manage files, edit configurations, and navigate your servers faster than ever.

Why AlmaLinux and Midnight Commander Are a Perfect Match

AlmaLinux was born as a direct replacement for CentOS, offering 1:1 binary compatibility with Red Hat Enterprise Linux. It is stable, predictable, and built for servers that need to run without surprises. Midnight Commander complements this perfectly because:

  • No GUI required — Most AlmaLinux servers run headless. MC gives you visual file management without X11 or a desktop environment.
  • Low resource usage — MC uses virtually no memory or CPU, ideal for production servers where resources matter.
  • Built-in editor — The mcedit editor is perfect for quick config file changes without learning Vim keybindings.
  • SFTP/FTP support — Connect to remote servers directly from within MC for file transfers.
  • Available in EPEL — Easy installation on AlmaLinux through the standard package repositories.

Installing Midnight Commander on AlmaLinux

Installation is straightforward. Midnight Commander is available in the base AlmaLinux repositories:

# Update your system first
sudo dnf update -y

# Install Midnight Commander
sudo dnf install mc -y

# Verify installation
mc --version

That is it. Three commands and you are ready to go. If you want the latest version, you can also enable the EPEL repository:

# Enable EPEL (if not already enabled)
sudo dnf install epel-release -y

# Install or update mc
sudo dnf install mc -y

First Launch: Understanding the Two-Panel Interface

Type mc in your terminal and press Enter. You will see two panels side by side, each showing a directory listing. This is the core concept:

  • Left panel — Your source (where you are copying/moving FROM)
  • Right panel — Your destination (where you are copying/moving TO)
  • Bottom bar — Function key shortcuts (F1-F10)
  • Command line — A regular shell prompt below the panels

Press Tab to switch between panels. Press Enter to open a directory or file. It is that simple.

Essential Keyboard Shortcuts Every Admin Must Know

Here are the shortcuts that will save you hours every week:

Navigation

  • Tab — Switch between left and right panels
  • Enter — Open directory or execute file
  • Alt+Y — Go to previous directory
  • Alt+U — Go to next directory
  • Ctrl+\ — Open directory hotlist (bookmarks)
  • Alt+C — Quick cd dialog

File Operations

  • F5 — Copy selected files to other panel
  • F6 — Move/rename selected files
  • F7 — Create new directory
  • F8 — Delete selected files
  • Insert — Select/deselect file
  • + (Plus) — Select files by pattern (e.g., *.conf)
  • \ (Backslash) — Deselect files by pattern

Viewing and Editing

  • F3 — View file contents
  • F4 — Edit file (opens mcedit)
  • Ctrl+X, Q — Quick view in other panel

Practical Use Case 1: Managing Configuration Files

One of the most common sysadmin tasks on AlmaLinux is editing configuration files. With MC, this becomes effortless:

# Launch mc and navigate to /etc
mc /etc

# Use F4 to edit any config file
# mcedit provides syntax highlighting for common formats

# Quick example: edit SSH config
# Navigate to /etc/ssh/sshd_config, press F4

The built-in mcedit editor offers:

  • Syntax highlighting for config files, scripts, and code
  • Search and replace (F7 / F4)
  • Block selection and operations
  • Undo/redo support
  • Line numbers and bracket matching

Practical Use Case 2: Batch File Operations

Need to copy all .conf files from one directory to another? In the terminal, you would type:

cp /etc/nginx/conf.d/*.conf /backup/nginx/

In MC, you can do it visually:

  1. Navigate the left panel to /etc/nginx/conf.d/
  2. Navigate the right panel to /backup/nginx/
  3. Press + and type *.conf to select all config files
  4. Press F5 to copy them

This visual approach reduces errors, especially when dealing with hundreds of files across complex directory structures.

Practical Use Case 3: Remote File Management via SFTP

One of MC's most powerful features is built-in SFTP support. You can browse remote servers as if they were local directories:

# In MC, press F9 > Left/Right > Shell Link
# Or press Ctrl+\ and add an SFTP bookmark

# Format: sh://user@hostname[:port]/path
# Example: sh://admin@192.168.1.50/etc

This means you can:

  • Copy files between your local AlmaLinux server and a remote server
  • Edit remote configuration files directly with mcedit
  • Compare directory structures across servers
  • Transfer files without installing additional tools

Practical Use Case 4: Comparing Directories

After deploying updates or restoring from backup, you often need to compare two directories:

# In MC:
# 1. Navigate left panel to /var/www/html (production)
# 2. Navigate right panel to /backup/www/html (backup)
# 3. Press Ctrl+X, D to compare directories

# Files that differ will be highlighted
# This is invaluable for verifying deployments

Customizing MC on AlmaLinux

Make MC work the way you want by customizing its configuration:

# MC config is stored in ~/.config/mc/
# Main config: ~/.config/mc/ini
# Skin/theme: ~/.config/mc/ini [Midnight-Commander] skin=

# To change the editor from mcedit to vim or nano:
# Press F9 > Options > Configuration > Use internal edit (toggle off)
# Then set EDITOR environment variable:
export EDITOR=vim

Useful .bashrc Aliases

# Add to ~/.bashrc for quick access
alias mc='mc --nosubshell'          # Faster startup
alias mce='mc -e'                   # Open MC editor directly
alias mcv='mc -v'                   # Open MC viewer directly

Advanced Tips for Power Users

1. User Menu (F2)

Create custom actions that appear when you press F2. Edit ~/.config/mc/menu to add your own commands, such as:

  • Compress selected files to tar.gz
  • Change file permissions recursively
  • Search for text within selected files

2. Directory Hotlist (Ctrl+\)

Bookmark your most-used directories for instant access. Essential bookmarks for AlmaLinux admins:

  • /etc/nginx/ or /etc/httpd/ — Web server config
  • /var/log/ — System logs
  • /var/www/ — Web content
  • /etc/sysconfig/ — AlmaLinux system configuration
  • /etc/firewalld/ — Firewall rules

3. Viewing Compressed Files

MC can look inside compressed archives (tar.gz, zip, rpm) without extracting them. Simply navigate to the archive and press Enter — MC will show the contents as a virtual directory.

4. Finding Files

Press Alt+? to open the powerful Find File dialog. You can search by:

  • File name pattern
  • File content (grep-like search)
  • File size and date

MC and AlmaLinux Security Considerations

When using MC on production AlmaLinux servers, keep these security practices in mind:

  • Never run MC as root unnecessarily — Use sudo mc only when you need to edit system files.
  • Be careful with F8 (Delete) — MC deletes files permanently by default. Enable the safe delete option in F9 > Options > Configuration.
  • SFTP connections — Use SSH key authentication instead of passwords when connecting to remote servers.
  • Audit trail — MC operations are not logged by default. For compliance, consider enabling command logging.
  • SELinux awareness — AlmaLinux has SELinux enabled by default. When moving files with MC, SELinux contexts may not be preserved. Use restorecon -Rv /path after moving files to critical directories.

Troubleshooting Common Issues

MC looks broken or garbled

# Set correct terminal type
export TERM=xterm-256color

# Ensure UTF-8 locale
export LANG=en_US.UTF-8

Function keys not working (especially over SSH)

# Some terminal emulators intercept F-keys
# Solution: Use ESC+number instead
# ESC+1 = F1, ESC+2 = F2, etc.

Slow performance on directories with many files

# Disable automatic file size calculation
# F9 > Options > Panel Options > Show mini-status (toggle off)

Recommended Reading: Take Your Skills Further

If this guide has inspired you to deepen your Linux administration skills, here are some books from our catalog that pair perfectly with what you have learned:

  • AlmaLinux for Beginners by Thomas Ellison — The comprehensive guide to getting started with AlmaLinux, from installation to server management. Perfect if you are new to the RHEL ecosystem.
  • Linux Command Line Mastery by Miles Everhart — Master the terminal commands that complement Midnight Commander. When you need to go beyond the visual interface, this book has you covered.
  • Linux System Administration Handbook by Miles Everhart — The complete reference for managing Linux servers, including file systems, permissions, and the tools that make administration efficient.
  • Bash Mastery 2026 by Miles Everhart — Combine MC with powerful Bash scripts for automated file management. Learn to create custom MC menu actions powered by Bash.
  • Master Linux Command Line in 30 Comprehensive Chapters — A deep dive into every aspect of the Linux command line, the perfect companion to MC for when you need the full power of the shell.

Conclusion

Midnight Commander is one of those tools that seems simple on the surface but reveals incredible depth the more you use it. On AlmaLinux, it fills the gap between the raw command line and a full GUI, giving you speed, safety, and visual clarity for your daily file management tasks.

Whether you are managing a single development server or a fleet of production machines, investing 30 minutes to learn MC will save you hours every week. Install it today, bookmark your key directories, and watch your productivity soar.

Have questions about using Midnight Commander on AlmaLinux? Drop us a message on our Contact page — our team of Linux experts is happy to help.

Share this article:

Stay Updated

Subscribe to our newsletter for the latest tutorials, tips, and exclusive offers.