Using Midnight Commander to browse Linux directories

Midnight Commander – the “mc” command – provides an easy way to browse directories and view, move, delete, compare, modify, and edit files. Similar in some respects to tidy, mc makes it easy to move through directories and offers side-by-side file / directory listings that work independently of each other. Plus, it provides a very wide range of actions that you can perform through simple menu choices.

To start Midnight Commander, simply type “mc” in a terminal window. When you open mc, the left and right sides of the screen will look the same and display the contents of the directory you started in. You can change sides using the tongue or simply by clicking on a directory or file on the side of the screen. You can select a file or directory just by clicking on it. You can also browse the contents of the directory using the up and down arrow keys.

As you move through files on one side of the screen, the other side will remain as it was.

As an example of use mc, you can edit a file by simply clicking on the file name and then clicking on the word Edit at the bottom of the screen. This opens the file in nano.

Speaking of the row at the bottom of your screen, you’ll notice that it displays a list of actions you can take. You can click on any of them to invoke the designated action. This line will look like this:

1Help  2Menu  3View  4Edit  5Copy  6RenMov  7Mkdir  8Delete  9 PullDn  10Quit

These choices are both numbered and named because they can be invoked by clicking on the names, using the associated function key (for example, F1 for help), or by using an escape sequence (for example, Esc-3 for sight).

These choices do the following:

  • To help brings up a help page that you can exit by pressing the key Esc key.
  • Menu opens a menu showing the commands you can perform. For example, you can compress the selected file with bzip2 just by typing “b”.
  • Seen displays the contents of the file. Press the space bar to move to the next data screen and the escape key to exit. For some types of files, you will only see descriptive information (not the contents of the file).
  • Edit opens the file in a text editor and lets you make and save changes.
  • Copy makes a copy of the selected file after opening a form that allows you to specify a file name.
  • RenMov renames and moves a file after opening a form that lets you specify details.
  • Mkdir creates a new directory after opening a form that allows you to specify a name.
  • Wipe off deletes the selected file or directory. You can even choose to delete a directory recursively.
  • PullDn allows you to use the drop-down menus at the top of the screen. They offer many additional options (for example, using the To file drop-down, you can change file permissions, change symbolic links, etc.).
  • To leave leaves Midnight Commander

By pressing Menu brings up these choices:

@	Do something on the current file 
0	Edit a bug report an send it to root 
2	Call the info hypertext browser 
3	Compress the current subdirectory (tar.gz) 
4	Compress the current subdirectory (tar.bz2) 
5	Compress the current subdirectory (tar.xz) 
6	Compress the current subdirectory (tar.xz) 
7	Compress the current subdirectory (tar.zst)
a	Append file to opposite
d	Delete file is a copy exists in the other directory
m	View manual page 
n	Inspect gzip'ed newsbatch file 
h	Strip headers from current newsarticle 
r	Copy file to remote host 
y	Gzip or gunzip current file 
b	Bzip2 or bunzip2 current file

As you can see, the changes you can make with the press of a single key are impressive.

hurry Esc to quit this list.

Examples of commands

To move to a directory, select it and press the key. Enter key.

To view a file, select it and press Seen. Press the space bar to view more of the file and Esc to exit the content display.

To delete a file, select it and press Wipe off. You will need to confirm the deletion.

To rename a file, select it and press RenMov. You will be prompted to enter the new name. Then press Okay.

To change file permissions, tap PullDn, mouse right to To file and down arrow for chmod and press Enter. A very user-friendly form will open and allow you to select the permissions you want. Then click on Adjust.

To exit Midnight Commander, click To leave. If that doesn’t work, you’ll probably have to press again Esc first to leave another list you were viewing.

This is just a sample of the things you can do with this tool.

Order of registration

In Midnight Commander, the list will show directories, then files. The “hidden” (those starting with “.”) Will be listed first, followed by those starting with upper case letters then lower case.

The file will be color coded by type.

  • Directories – white
  • Files – gray
  • Images – light blue
  • Compressed files – pink
  • Video files – green
  • Blue background

You can make changes by editing mc ‘configuration file. It will be ~ / .config / mc / ini Where ~ / .mc / ini.


Midnight Commander is a powerful tool for browsing, comparing, moving, modifying, and manipulating files in a way that many consider user-friendly. That is, you don’t need to type a lot of Linux commands, but you have to get used to clicking on its menus and forms. Some of its features, such as the ability to compare file lists side by side or change permissions by clicking permission boxes, are quite unique. For most of us, mc might make working on linux a very different experience.

Join the Network World communities on Facebook and LinkedIn to comment on the topics that matter to you.

Copyright © 2020 IDG Communications, Inc.

Comments are closed.