How to Install and Use Midnight Commander in Linux

Rumaisa Niazi
5 min readOct 8, 2021

--

Even if it is moving or copying the files in Linux: working with files in a console environment can be a hard and tedious task for a novice user. You have to remember every syntax to perform a function. In the GUI (Graphical User Interface) environment, a File Manager helps perform these file-associated activities in seconds with just a few clicks and drag.

To overcome the issue with the console environment, Linux has a text-based File Manager known as the Midnight Commander. The article is a guide on Midnight Commander installation and its usage.

The Installation Process

Midnight Commander is not a default Linux system utility. Type the following command to install it in your system:

ubuntu@ubuntu:~$ sudo apt install mc

After the installation, launch the Midnight Commander by simply just typing “mc” in the Linux terminal:

ubuntu@ubuntu:~$ mc

The following window will appear on your screen:

Features of Midnight Commander

After launching the GUI tool, you can discover all the features it has to offer. It helps a user perform day-to-day activities such as copy, delete, directory creation, renaming, and moving a file.

As shown in the screenshot above, the Midnight Commander has two separate columns. Each window represents an active directory; use the Tab key to switch between these windows.

The midnight commander provides navigation through both mouse and keyboard. At the bottom of the Midnight Commander, the buttons are pre-fixed from F1-F10 numbers on a keyboard.

The keys allow us to perform various functions on a selected file. For example, to copy a file from one place to another, highlight the selected file and press F5. If there are multiple files to be copied, press the Insert button for each of the files to be copied.

The Midnight Commander will ask about different parameters like the Destination(To), Follow Links, Preserve Attributes, etc. If a person does not know much about these terms, the focus should only be on the To parameter as Destination is the only parameter required.

To move or rename a file, press the F6 key. To move the files from one location to the other, then the path is the required parameter. However, if you also want to rename the file, then include the “New Filename” in the To parameter, as shown in the following screenshot.

It also creates new directories, go to your desired location to place the new directory and press the F7 key.

To edit a file in the Midnight Commander, select the desired file and press the F4 key.

Once the file has been edited, use the Ctrl and the specified button to perform the desired function. For example, press Ctrl+X to exit the editor.

After file update, you can view the file by pressing the F3 key:

Similarly, other functions can be performed as well in the Midnight Commander by using the F1-F10 keys.

Internal Viewer

When you run the text editor for the first time by pressing F4, the Midnight Commander will ask to choose an editor for the file. In the console mode, there are several editors which include joe, nano, etc.

To change the editor on the Midnight Commander, press F2, and a menu will open. After that, press @ button and write the command select-editor as shown in the following screenshot:

You will be able to change your editor to the desired one.

File Permissions

Files and directories can also be restricted to read, write and execute by managing permissions using the chmod command. View the detailed description of the chmod command from man as follows:

ubuntu@ubuntu:~$ man chmod

Select a file, and press the key F9>File>chmod. The Midnight Commander will open the permissions menu, and the user can select their desired permissions.

Ownership of a File

Besides setting the file permissions, Midnight Commander also allows us to manage the file or directory ownership. We can set the privileges of the owner and group owner. Detailed information of chown can be viewed by:

ubuntu@ubuntu:~$ man chown

Use chown by pressing F9>File>Chown. The Midnight commander will open the ownership menu for the selected file to set the owner or group owner for the file from the available list of usernames and group names.

It also includes an Advanced Chown command available in the Midnight Commander. The command provides chmod and chown combination to set file or directory permissions and select both owner and group owner.

The article shows how to install Midnight Commander, a GUI tool to enable us to manage files and directories in Linux in a convenient way. The article aims at familiarizing users with the basic features of the tool. It shows keys to move around files and directories, view files, and make changes to the file with the help of Midnight Commander. The article also shows how to change user and group ownership of the files/directories and set permissions.

--

--