Home » Guides » How To Install Midnight Commander On Linux: Ubuntu, Debian, RHEL, CentOS, Arch Linux, etc.

How To Install Midnight Commander On Linux: Ubuntu, Debian, RHEL, CentOS, Arch Linux, etc.

If you are familiar with Linux, then surely, you can appreciate Midnight Commander, which is a powerful file manager. It is a text-based file manager running line interface that can enhance your workload. As a rule, you won’t find many file managers for Linux. And even amongst those available, Midnight Commander stands out. It has been around for years now.

Thus, I am writing this article to provide our readers with a comprehensive guide on how to install Midnight Commander on Linux distributions such as Ubuntu, Debian, RHEL, CentOS, and so on.

Table Of Contents

What is Midnight Commander?

Midnight Commander, as we already mentioned, is a command-line file manager for Linux systems. It makes managing files on Linux much easier. It is a two-panel file viewer with drag and drop feature. Furthermore, it also sports a built-in file viewer and editor, that makes file management a simple task for Linux users. You can even use it to manage files remotely, as it supports almost all Linux Bash shells and SSH clients.

Midnight Commander

Key Features:

Midnight Commander offers a comprehensive collection of features, such as:

  • Text-based UI: Since it runs on the command line, the file manager sports a text-based UI (TUI). It is visually appealing and makes it much easier to navigate, even for new users. 
  • Two-Panel Layout: Another feature of the tool is that it has a dual pane. Thus, users can view and manage files at the same time. It also allows users to view and manage files in two directories at once. You can also use these panels for drag and drop.
  • Integrated Viewer and Editor: You can use it simultaneously to view and edit files at once, that too without leaving the interface. 
  • Basic operations: The tool supports basic operations such as copy, paste, search, view, and even FTP and SFTP operations. 
  • Customization: You can also assign custom key shortcuts for particular operations, making it much more user-friendly. 
  • Versatile: The program is available on most Linux distros, as well as Windows, making it quite versatile.

How to Install Midnight Commander on Linux?

Let’s get down to actually installing Midnight Commander on Linux. As we all know, it is natively available for most Linux distros, so we will use the formal repositories on these to install Midnight Commander directly. Also, users can build it from a source, as the package is available on Git.

Then, there are third-party solutions such as Snap, Flatpak, Homebrew, Conda, and even AppImage that allow users to install, manage, and run MC on various Linux distributions.

Method 1. Install Midnight Commander on Linux From Source

As mentioned above, you can use the Git repository to fetch and compile Midnight Commander on your system. For the following example, we are using Ubuntu/Debian, however, you can compile it on others too. Here’s how:

Step 1. Start by installing the necessary dependencies. These are:

  • gcc
  • make
  • autoconf
  • automake
  • libtool
  • glib2
  • slang2 or ncurses
  • gettext
  • libssh2 (only for sftp vfs)
  • libaspell (for spell checking in the internal editor)
  • ext2fs (to support ext2/3/4fs extended attributes)

Step 1.2. Use this command for Debian/Ubuntu:

sudo apt-get install gcc make autoconf automake libtool glib2.0-dev libslang2-dev libncurses5-dev gettext libssh2-1-dev libaspell-dev libext2fs-dev

Step 1.3. And, for RedHat/CentOS/Fedora, use this command:

sudo dnf install gcc make autoconf automake libtool gettext glib2-devel slang-devel gtk2-devel

Or,

sudo yum groupinstall 'Development Tools'

Step 2. Now, get the Source Code from the Midnight Commander repository from GitHub:

git clone https://github.com/MidnightCommander/mc.git

Step 3. After that, extract the Source Code using TAR.

tar -xvf mc-<VERSION>.tar.xz

Step 4. Then, navigate to the directory where you extracted and configure the package.

cd mc
./configure

Step 5. Use the MAKE command to compile the Source Code:

make

Step 6. Finally, install Midnight Commander

sudo make install

Method 2. Install Using Native Linux Repositories

The other method is obviously using the native repositories on Linux. We have listed the various Linux distributions and how to install Midnight Commander on these Linux systems.

Debian/Ubuntu:

For Debian and Ubuntu systems, we can use the APT repo:

Step 1. Start by updating the APT package manager:

sudo apt update

Step 2. Then install Midnight Commander:

sudo apt install mc

Fedora:

Similarly, you can run the DNF command on Fedora-based systems:

Step 1. Update the DNF repository:

sudo dnf update

Step 2. Then, install MC (Midnight Commander)

sudo dnf install mc

CentOS/RHEL:

If you have CentOS, you can try the YUM repo for installing MC:

Step 1. Just like the other distros, we have to start by updating the YUM package manager

sudo yum update

Step 2. Then, install it using the same command:

sudo yum install mc

Using EPEL

You can also use the EPEL repositories:

Step 1. First, enable the CodeReady Linux Builder repository.

sudo subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms

Step 2. Then, install the EPEL repo.

sudo dnf install \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

Step 3. Finally, install Ranger from EPEL:

sudo dnf install mc

Arch Linux:

Step 1. Using the pacman repo:

sudo pacman -Syu
sudo pacman -S mc

Or,

Using the AUR Repo:

Step 1. Start by installing YAY:

sudo pacman -S yay

Step 2. Then, install Midnight Commander using it:

yay -S mc

openSUSE:

Step 1. Install MC using the ZYPPER command:

sudo zypper install mc

Gentoo:

Step 1. Use the Emerge command to install Midnight Commander:

sudo emerge --ask app-misc/mc

Method 3. Use Snap To Install Midnight Commander

The popular package manager distributes applications directly to Linux users. You can use Snap to install MC on your system. Here’s how:

For Ubuntu, Debian, Linux Mint, etc.

Step 1. First, install Snap on your system using the APT command.

sudo apt install snapd

Step 2. Then install Midnight Commander:

sudo snap install mc

On Systems Running Fedora, CentOS, RHEL, etc.

Step 1. Start by installing Snap

Fedora
sudo dnf install snapd
CentOS/RHEL
sudo yum install epel-release -y && sudo yum install snapd -y

Step 2. Now, enable Snap (needed only for CentOS/RHEL-based systems)

sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap

Step 3. Finally, install Midnight Commander

sudo snap install mc

For Arch Linux, Manjaro, etc.

Step 1. Start by installing Snap

sudo pacman -S snapd

Step 2. Then, enable it on your system.

sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap

Step 3. Lastly, install MC.

sudo snap install mc

Method 4. Install MC Using Flatpak

It is an open-source framework that allows users to manage and develop software for Linux systems. Thus, you can use Flatpak to install Midnight Commander on most Linux distributions.

Step 1. First, install Flatpak on your system:

For Debian-based systems

sudo apt install flatpak

For Fedora-based systems

sudo dnf install flatpak

On Arch-based systems

sudo pacman -S flatpak

Step 2. Now, add the Flatpak repository.

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Step 3. And lastly, install Midnight Commander:

flatpak install flathub org.midnightcommander.mc

Method 5. Use Homebrew to Install Midnight Commander

Although Homebrew is a macOS package manager, you can use it to install applications on most Linux systems. Here’s how:

Step 1. First, install Homebrew on your system:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 2. Now, you have to add it to the PATH:

echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >>~/.profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

Step 3. Install Midnight Commander

brew install mc

Method 6. Installing Midnight Commander Using AppImage

AppImage is an open-source format for installing and distributing portable software on Linux. Thus, you can use it to install applications independent of specific Linux distributions or their dependencies.

Follow these steps to install Midnight Commander on Linux using AppImage:

Step 1. First, visit the AppImageHub or search online for the MC AppImage.

Step 2. Then, download the AppImage and make it executable:

chmod +x /path/to/mc.AppImage

Step 3. Finally, run the AppImage

./mc.AppImage

Conclusion

Hailed as a lightweight yet versatile file manager, Midnight Commander is a useful tool for Linux users. The following article has highlighted how easy it is to install MC on most Linux distributions with a few commands.

You can use the above-mentioned methods to finally install MC on your Linux distro. However, for more information on other Linux-based solutions, reviews, or guides, do visit our website.

Gilbert John Avatar