Open In App

How to Use Midnight Commander, a Visual File Manager

Last Updated : 20 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

For Unix-like systems, Midnight Commander (MC) is a potent visual file manager with an easy-to-use interface for organizing and managing files and directories. It is perfect for distant servers and systems without graphical user interfaces because it functions in a text-based environment. The fundamentals of using Midnight Commander to manage files and directories effectively from the command line are covered in this article. With the two-pane interface that Midnight Commander offers, users may use keyboard shortcuts to traverse across folders and carry out different file actions.

What is Midnight Commander?

For Unix-like operating systems, Midnight Commander, sometimes shortened to “mc,” is a strong and well-liked text-based file manager. It offers an easy-to-use interface for handling directories and files in a terminal environment. The following are a few of Midnight Commander’s main features:

  1. Two-Panel Interface: Midnight Commander has two distinct panels that let users view and manage files and directories at the same time. File activities like copying, transferring, and comparing files between directories are made simple by this arrangement.
  2. File Operations: There are many other file operations that Midnight Commander can perform, such as copying, moving, renaming, deleting, and creating directories and files. An easy-to-use menu-driven interface or keyboard shortcuts can be used by users to carry out these tasks.
  3. File Viewer: A built-in file viewer for a variety of file formats, including text, binary, and archive files, is available in Midnight Commander. Files can be instantly seen by users without requiring them to be opened in other programs.
  4. File Compression and Extraction: Using well-known archive formats like ZIP, TAR, GZIP, and BZIP2, users of Midnight Commander may compress and extract files and folders. Large-scale file management and archiving are made easier by this functionality.

How to install Midnight Commander on Linux Distributions?

For Ubuntu-based distributions (such as Ubuntu, Linux Mint, etc.):

sudo apt-get install mc

Installation on Ubuntu

For Red Hat-based distributions (such as Fedora, CentOS, RHEL, etc.):

sudo dnf install mc

OR

sudo yum install mc

For Arch-based distributions (such as Arch Linux, Manjaro, etc.):

sudo pacman -s install mc

How to Use Midnight Commander?

In this section, we will explore the practical usage of Midnight Commander on Ubuntu OS. We will see the various examples of performing file actions using this File Manager.

Example 1: Opening Midnight Commander

To open Midnight Commander, simply type “mc” in your terminal and press Enter. This command launches the Midnight Commander file manager, providing a user-friendly interface for file navigation and management on Ubuntu OS.

mc

Opening Midnight Commander

Example 2: Navigating Through Directories

Step 1: To navigate through directories in Midnight Commander, use the Tab or arrow keys to switch between the two panes. This enables seamless movement between files and folders, enhancing efficiency in file exploration and management within the Midnight Commander interface.

Navigating through Directories

Step 2: To open a file or navigate into a directory in Midnight Commander, simply press Enter after selecting the desired file or directory. This action allows for quick access to files and further exploration within the chosen directory.

Example 3: File Operations

1. Copying Files

To copy files in Midnight Commander, use the arrow keys to select the files or directories you want to copy, then press F5. This initiates the copy operation, allowing you to choose the destination directory for the copied files.

Copying File

2. Moving Files:

To move files in Midnight Commander, select the desired files or directories using the arrow keys, and then press F6. This triggers the move operation, and you can choose the destination directory for the moved files. Midnight Commander simplifies file management by providing a straightforward way to move selected items within its user-friendly interface.

Moving Files

3. Deleting Files:

To delete files or folders in Midnight Commander, select the items you want to remove using the arrow keys, and then press F8. This action triggers the delete operation, prompting you to confirm the deletion. Midnight Commander streamlines the process of file deletion with the F8 key, enhancing efficiency in managing files within its interface.

Deleting Files

4. Creating a New Directory:

To make a new directory in Midnight Commander, press F7. This action prompts you to enter the name of the new directory and once confirmed, a fresh directory is created in the current location. Midnight Commander provides a convenient shortcut with F7 for quickly and easily adding new directories within its file management interface.

Creating New Directory

5. Accessing the Menu:

To access the menu for additional operations, such as renaming files or altering permissions, press F9. This opens a menu with various options, allowing you to perform advanced file-related tasks within Midnight Commander. The F9 key provides a gateway to a range of functionalities beyond basic file operations, enhancing the versatility of the file manager.

Example 4: Other Useful Features

  1. To toggle the display of hidden files, press Ctrl+O.
  2. Open a new tab with Ctrl+X followed by Ctrl+T.
  3. Search for files or directories using Ctrl+.
  4. Refresh the current panel with Ctrl+R.

These keyboard shortcuts showcase additional features in Midnight Commander, providing quick access to functions like displaying hidden files, opening new tabs, searching, and refreshing the interface.

Other Useful Features

Example 5: Exiting Midnight Commander

To exit Midnight Commander, press F10 or Ctrl+O, then press “x“. This key combination ensures a prompt exit from the Midnight Commander file manager, allowing you to close the application and return to the terminal.

Exiting Midnight Commander

Frequently Asked Questions on Midnight Commander, a Visual File Manager – FAQs

What is Midnight Commander (MC)?

For Unix-like operating systems, Midnight Commander—often shortened to MC—is a text-based visual file manager. It offers an easy-to-use interface for handling directories and files in a terminal environment.

How do I start Midnight Commander?

Just open a terminal, type mc, and hit Enter to launch Midnight Commander. The Midnight Commander interface will open as a result.

How do I navigate through directories in Midnight Commander?

In Midnight Commander, you can move between files and directories by using the Tab key or the arrow keys. The Enter key can also be used to open directories and see what’s inside of them.

How do I copy or move files in Midnight Commander?

Navigate to the source file or directory in Midnight Commander, select it with the Space key, navigate to the destination directory, and then hit F5 for copying or F6 for moving files. Verify the action by hitting Enter.

Can I delete files or directories in Midnight Commander?

In Midnight Commander, it is possible to remove files or directories by selecting the desired file or directory, hitting the F8 key, and then confirming the deletion.

How do I search for files in Midnight Commander?

By using the F9 key to access the main menu, choosing the “Find File” option, entering your search parameters, and hitting Enter, you can search for files with Midnight Commander.

Does Midnight Commander support file compression and extraction?

Yes, file compression and extraction for a variety of archive formats, including ZIP, TAR, GZIP, and BZIP2, are supported by Midnight Commander. By selecting the files, hitting the F2 key, and selecting the desired action, you can compress or extract them.

Conclusion

In conclusion, a flexible file manager, Midnight Commander makes file management chores easier in text-based environments. Without a graphical user interface, users may copy, move, delete, and execute other file operations with ease thanks to its user-friendly interface and keyboard shortcuts. On Unix-like systems, users can increase productivity and optimize their file management workflows by becoming proficient with Midnight Commander.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads