Midnight Commander in Action

[ Thursday, 23 August 2007, adz ]

There are a lot of free file managers. There is Nautilus in GNOME environment (with GTK libraries), KDE users have Konqueror and Krusader. There is also more and more useful Dolphin, which is destined to be default file manager to KDE 4. Fast Thunar can be found in less “heavy” graphical environment — XFCE 4. All those applications offer great functionality. However, they share a common feature which in unfavorable conditions would be considered as a defect — they enjoy as a rule very intertwined interdependences, they demand a lot of libraries connected with their graphical environment, and (which is obvious) they need X Window System server running. Of course, console zealots and users looking for “light” solutions are not left alone. They have MC!

Midnight Commander (mc for short) is the most popular console (command line) file manager. Its design was inspired by classic two-panel interface found in the famous Norton Commander, a DOS file manager. Midnight Commander is equipped in many functions:

  • native support of archives and deb and rpm packages, the files are treated like directories a user may enter and copy to/from files,
  • ability to connect to servers using ssh, ftp, and smb protocols,
  • possibility to mark many files a time and work on file groups using meta characters,
  • syntax highlighting in mcedit – mc embedded editor,
  • ability to issuing user commands against selected (marked) files,

and many others. It’s worth mentioning that MC’s DEB package is only 2 MB in size! Unfortunately, the default application do not support UTF-8 coding. There are patches only for openSUSE, Red HAT, and Gentoo distros. It can be interesting to say that MC was a default file manager for the first versions of GNOME, but it was ditched in behalf of graphical manager.


Because MC is distributed with every known GNU/Linux system and as a port for BSD systems’ family, its installation is trivial and rely on making use of a favorite package manager. It suffices to issue the following command in Debian/Ubuntu systems:

apt-get install mc

In Fedora/CentOS/Scientific Linux/Red Hat systems:

yum install mc

Windows and BeOS versions of MC exist, too. Thanks to open code policy MC was ported to corporation grade AIX and HP-UX operating systems. Solaris binary release can be downloaded from pages of Sun Freeware.


You can run MC in terminal issuing mc command. After the launch left panel will contain the directory the MC was run from. The right panel will show your home directory. Having been opened with directory path as a parameter, it will display its contents in the left panel. For example running the command mc /usr/src will open MC with src directory. MC can be run in command line environment with additional parameters like:

  • -b — force black and white display,
  • -c — force color mode,
  • -v <path to a file> — start the internal viewer to view the specified file,
  • -e <path to a file> — start the internal editor.

There is a possibility to run MC editor alone. You have to issue a mcedit command adding a file name with its path, e.g. mcedit /etc/fstab.

Pic. 1 Typical MC session

MC Basics

Moving around needs to master several keys — arrow keys, PgUp and PgDn keys, tab key to switch between the panels or to select menu options, and a space key for selections. Function keys F1 thru F10 are bound to most important functions:

  • F1 – Help menu,
  • F2 – User menu,
  • F3 – View,
  • F4 – Edit,
  • F5 – Copy,
  • F6 – Move file or directory,
  • F7 – MkDir (make directory),
  • F8 – Delete file/directory,
  • F9 – Moving cursor to main menu,
  • F10 – Exit.

Pic. 2 Black and white session

Keyboard Shortcuts

In the world of Windows Systems the most popular two-panel file manager is Total Commander. Apart from almost identical functionality, TC and MC enjoy different keyboard shortcuts. The table below shows comparison of the two groups.

Functions Midnight Commander Total Commander
Open directory menu CTRL + \ CTRL + D
Compare directories CTRL-X + D SHIFT + F2
Rescan (refresh panel contents) CTRL + R F2
Hide panels CTRL + O SHIFT + ESC
Reverse selection M + * NUM *
Find file ALT + ? ALT + F7
Quick view CTRL-X + Q CTRL+Q
Change file and directory rights – chmod Ctrl-X + C n. a.
Change file and directory owner – chown Ctrl-X + O n. a.
Make symlink Ctrl-X + S SHIFT+CTRL+F5

CTRL-X + D sequence must be issued by pressing together CTRL and X, and then D button – like in Emacs editor. A shortcut which should be mentioned here is ESC+0,1,2…9 which replaces all function keys F1 to F10. It is indispensable in terminals which do not support F1-F10 buttons.

Pic. 3 Directory hotlist — handy MC feature

Viewing Files

Midnight Commander, like many modern application designed to manage multiple files, offers possibility to view nearly any file contents. MC supports among others zip, rar, tar* archive files, rpm and deb packages, and pdf and man documentation files as well. You can look into ISO images without prior mountings. All mentioned files are treated as directories. To view ISO contents it is enough to select it with a mouse or cursor keys and press Enter. MC offers additionally a quick-view option where contents of a selected file will be displayed in adjoining panel. The option is available through left/right menu options and bound to CTRL-X + Q shortcut.

Pic. 4 HTML file preview in MC

File Group Management

To select a file you have to focus cursor on its name and press Insert. To mark a group of files you can make use of meta characters. To select a group choose the “select Group” option from menu File or reach for [Shift-+] shortcut. You will have to enter then a regular expression in a displayed window. For example *.odt will mark all the files with the odt extension, shortcut [Shift-\] will cancel selection, and [Shift-*] will reverse selection (e.g. MC will select all the files without the odt extension).

A selected group can be deleted, moved or copied but not only. You can perform any operation. To do that you have to open User menu (pressing F2 or User Menu from File option). Next, choose “Do something on the tagged files” (shortcut: @) and enter a command you want to run against the selected files.

There is a possibility to display files with features defined by a user. Please choose from main menu the right or the left option, then the Filter… option and at the end enter a filtering expression. For example *.pdf entry will the MC to show only the files which have pdf extension. Apart from that MC will show directories and symlinks.

Finding Files

MC offers search option. Look for “Find file” in “File” option present in main menu bar or simply use [Shift-s] shortcut and start typing. Of course MC makes use of regular expressions. Any found files will be displayed in “special” window where you will be able to do a few operations: “Chdir” will open a directory with found files in one of its panels, “Again” will move action back to search window where you can change the search criteria, “Panelize” will show all the found files and only the files in one of the MC’s panels.

Server Connections

Connections to servers can be performed in a following way. Choose in menu bar the left or the right option, select connection type (ftp, ssh, smb), and then enter server address, user’s name and user’s password in the following forms: user_name:password@server_address or user_name@server_address. When using second option you will be asked for a password. In the case of a “shell link”, the program will use protocol called FISH, designed specially for Midnight Commander. It is implemented in KDE as a kio-slave fish:// and used by lftp. This protocol needs a ssh daemon to be running on server side of the connection. To get a quick connection via FTP link all it takes is to enter in command line:

cd /#ftp:user_name:password@server_address/directory

eventually, in case of anonymous user

cd /#ftp:server_address/directory

So, in order to get connected to popular TASK server you should type in “cd /#ftp:ftp.task.gda.pl”. In the same way you will make connection with ssh server: “cd /#sh:user@server_address/directory”.

RPM and DEB Support

As I said earlier, MC supports two most popular Linux package systems – DEB and RPM. If you want to list all packages installed in your system enter “cd #rpms” in command line. After a while the list, grouped according to categories, will be shown in one of the MC’s panel. Similar ways can be applied to systems using DEB packages. It suffices to write in “cd #apt” or “cd #dpkg” to be able to look through all installed programs.

Pic. 5 Browsing APT repo with MC

F10 key in GNOME-terminal

There is a conflict between GNOME-terminal and MC shortcuts. It concerns mainly F10 which closes MC, but is used to open upper menu in GNOME-terminal. In order to get rid of the nuisance the following command should be run:

gconf -set /apps/gnome-terminal/global/use_menu_accelerators \\
 -type boot false

To have original settings one ought to change the false to a true option. This trick was found on openSUSE Polish wiki.

This article do not describe all features of MC. I suggest then to read the help text invoked by F1 key and system manual issuing man mc command.

More information

Translation: P2O2 – Aug 12, 2007

Subscribe to RSS feed for this article!


fold this thread mudrii  Thursday, 23 August 2007 o godz. 6:24 am #  Add karma Subtract karma  --2

Hey nice How-to big Thx


(Comments wont nest below this level)
fold this thread William "Papa" Meloney  Saturday, 25 August 2007 o godz. 7:03 pm #  Add karma Subtract karma  +1
(Comments wont nest below this level)
fold this thread kosmosiki  Saturday, 25 August 2007 o godz. 7:22 pm #  Add karma Subtract karma  +2

Add following lines to your ~/.mc/ini file for cool color scheme like this one. :)


(Comments wont nest below this level)
fold this thread John Wiredland  Monday, 27 August 2007 o godz. 11:35 am #  Add karma Subtract karma  --1

MC rocks.

Those who start using Linux will love the built-in editor without the need to learn vi.

Always activating mc from root to give uourself more rights.

(Comments wont nest below this level)
fold this thread P2O2  Monday, 27 August 2007 o godz. 12:25 pm #  Add karma Subtract karma  +0


Try to make two MC flavors for a common user and a superuser like this:

prog “mc user” mcg_01 xterm -bg darkgreen -cr yellow -fg white -sl 1500 -e mc
prog “mc root” mcr_01 sudo xterm -bg darkred -cr yellow -fg white -sl 1500 -e mc

Examples of the colored xterm windows with MCs within them and their icons on the Desktop can be found here:

The excerpts above come from my IceWM Toolbar config file. mcg_01 denotes MC User’s Icon (g for green, r for red). Do not forget to install sudo application.

It suffices to make two aliases or scripts for the xterm (…) invocations:

xterm -bg darkgreen -cr yellow -fg white -sl 1500 -e mc

sudo xterm -bg darkred -cr yellow -fg white -sl 1500 -e mc


(Comments wont nest below this level)
fold this thread blah  Monday, 27 August 2007 o godz. 12:30 pm #  Add karma Subtract karma  +0

After many years MC is still the only decent file manager for IT proffessionals.

(Comments wont nest below this level)
fold this thread Velko  Monday, 27 August 2007 o godz. 12:43 pm #  Add karma Subtract karma  +0

Well, some time ago I added lines


to /etc/skel/.bash_profile

Thus, MC starts automatically for new users.

I found out, that this is “less scary” than plain bash prompt for newbie users. Advanced users are free to remove this from their own ~/.bash_profile

(Comments wont nest below this level)
fold this thread gnilbeil  Tuesday, 28 August 2007 o godz. 5:01 am #  Add karma Subtract karma  +0

still bad to handle utf8-coded i18n messages.

(Comments wont nest below this level)
fold this thread frank  Tuesday, 28 August 2007 o godz. 6:19 am #  Add karma Subtract karma  --1

MC is an indispensable program, powerful and efficient. I’ve been using it with a visual setting that I find most pleasing. Using Eterm set to be completely transparent and invisible, MC simply floats on the screen.

Using Ctrl-o to hide panels, or “shell out” leaves nothing but the disembodied command prompt on the “desktop.” Execute a command that produces abundant text in stdout and the screen fills with scrolling text all while you see your foolish “trash can” and other desktop icons behind.

Here’s how:

in ~/.mc/ini copy and paste this -


and create a launcher or a keybinding or script or whatever, to do this -

Eterm –trans –borderless –scrollbar off –buttonbar off –geometry 100×44+185+65 –font 10×20 –foreground-color white -e mc

You WILL be amused.


(Comments wont nest below this level)
fold this thread barteqx  Wednesday, 29 August 2007 o godz. 5:51 pm #  Add karma Subtract karma  --1

MC has helped me, when I couldn’t log in to my account. It’s very useful tool.

Very good article – I hope all next articles will good, like this.

(Comments wont nest below this level)
fold this thread klemen  Thursday, 30 August 2007 o godz. 2:49 pm #  Add karma Subtract karma  --1

I use it years ago when started with Slackware Linux. Very good program.

(Comments wont nest below this level)
fold this thread marian.hello  Monday, 3 September 2007 o godz. 8:38 am #  Add karma Subtract karma  +1

Does anybody know, how can I stay in actual path, after closing mc. I mean when I start mc from ~/home/user and then navigate to /usr (in mc) and then quit mc, current path is ~/home/user, but I would like to be in /usr.

(Comments wont nest below this level)
fold this thread harry  Sunday, 9 September 2007 o godz. 1:59 pm #  Add karma Subtract karma  +1

Does anybody know, how can I stay in actual path, after closing mc

See man-page:

-P file, –printwd=file

Print the last working directory to the specified file. This option is not meant to be used directly. Instead, it’s used from a special shell script that automatically changes the current directory of the shell to the last directory the Midnight Commander was in. Source the file /usr/share/mc/bin/mc.sh (bash and zsh users) or /usr/share/mc/bin/mc.csh (tcsh users) respectively to define mc as an alias to the appropriate shell script.

fold this thread Charles  Thursday, 29 November 2007 o godz. 5:21 pm #  Add karma Subtract karma  +0

See man-page: -P file, –printwd=file

(and what the man page said…)

…this is great, but what does it MEAN? Exactly how does one “source” the script or whatever? How does one stay in the actual path after closing mc?

I run all of the bash scripts from the bin directory (is that what “sourcing” means?) but nothing changes.

I’m sure I’m not the only one who needs a little help beyond the man page.

fold this thread e1luca  Friday, 1 May 2009 o godz. 4:18 pm #  Add karma Subtract karma  --1

“Does anybody know, how can I stay in actual path, after closing mc”

Although welcomed, Charlie’s response was no help for me either. I anybody could geve more details pls…

fold this thread KIAaze  Tuesday, 25 August 2009 o godz. 9:40 pm #  Add karma Subtract karma  +1

To source a script means to run “source” or “.” with the script as argument.
source /usr/share/mc/bin/mc.sh

cf: http://learnlinux.tsf.org.za/courses/build/shell-scripting/ch10s02.html

I put the source line into my ~/.bashrc and it works well. :)
Thanks harry.

fold this thread Turan  Friday, 25 December 2009 o godz. 10:46 pm #  Add karma Subtract karma  --1

just put an alias in your shell command
assume that u r using bash

so just add
.bashrc file in that line

alias mc=’. /usr/share/mc/bin/mc-wrapper.sh’

that’s all

Now mc remembers the last directory when u exit.

fold this thread luser  Thursday, 9 October 2008 o godz. 7:03 pm #  Add karma Subtract karma  --1

I have problem with my MC… not sure if it’s normal?
When I connect to remote FTP server with default directory other than “/”, then MC won’t connect to such server. So I have to type whole path after the server name e.g. luser:password@server/home/luser


(Comments wont nest below this level)
fold this thread infinkoccubw  Thursday, 4 December 2008 o godz. 5:37 am #  Add karma Subtract karma  --5

http://tribuneunhoped.freehostia.com/card7e7.html canadian banks pre paid credit card

(Comments wont nest below this level)
fold this thread health insurance quote  Thursday, 9 May 2013 o godz. 3:22 am #  Add karma Subtract karma  +0

Hi! Would you mind if I share your blog with my twitter group?

There’s a lot of folks that I think would really enjoy your content. Please let me know. Many thanks

(Comments wont nest below this level)
fold this thread Brigette  Sunday, 12 May 2013 o godz. 12:07 pm #  Add karma Subtract karma  +0

hello!,I love your writing very much! proportion we keep up
a correspondence more approximately your article on AOL?
I require an expert in this house to solve my problem.
May be that is you! Looking ahead to see you.

(Comments wont nest below this level)
fold this thread pit 28 2013  Friday, 18 October 2013 o godz. 1:07 am #  Add karma Subtract karma  +0

I’ve read some excellent stuff here. Definitely worth bookmarking for revisiting.
I surprise how much attempt you put to create any such magnificent informative site.|

(Comments wont nest below this level)
fold this thread Virgilio  Saturday, 10 May 2014 o godz. 2:03 pm #  Add karma Subtract karma  +0

I really love your blog.. Pleasant colors & theme. Did you make this web site yourself?
Please reply back as I’m planning to create my own personal site and would love to
find out where you got this from or just what the theme is named.
Thank you!

(Comments wont nest below this level)
fold this thread wyniki przetargów  Friday, 16 May 2014 o godz. 1:31 am #  Add karma Subtract karma  +0

Now these are just projections, but if you pay a fine — in other words, the number of banks that auction 63366 had failed so far, and they
succeeded. And in order to be a permanent
loss. Where a super fund, if it’s a program or whatever
that may be one of our children; it might be important. Being a Mission Main Street Grants through an email
that I received?

(Comments wont nest below this level)
fold this thread https://www.etsy.com/shop/ITEMFACTORY  Friday, 23 May 2014 o godz. 9:28 am #  Add karma Subtract karma  +0

These are in fact impressive ideas in concerning blogging.
You have touched some fastidious things here. Any way keep up wrinting.

(Comments wont nest below this level)
fold this thread homepage  Saturday, 24 May 2014 o godz. 5:38 am #  Add karma Subtract karma  +0

Hi there just wanted to give you a quick heads up.
The text in your post seem to be running off the screen in Chrome.
I’m not sure if this is a format issue or something to
do with browser compatibility but I figured I’d post to let you know.
The layout look great though! Hope you get the
issue resolved soon. Kudos

(Comments wont nest below this level)
fold this thread affiliate marketing websites india  Saturday, 31 May 2014 o godz. 7:06 pm #  Add karma Subtract karma  +0

I’m really inspired with your writing skills as neatly as with
the structure in your blog. Is that this a paid subject matter or did you customize it your self?
Anyway keep up the excellent quality writing, it’s uncommon to peer
a nice weblog like this one nowadays..

(Comments wont nest below this level)
fold this thread La Planète des singes l'affrontement le film  Monday, 28 July 2014 o godz. 7:00 pm #  Add karma Subtract karma  +0

Elements typically seen on movie screens were guns drawn and cleavages exposed.
The style of a well used movie theater can be carried out
using the structural arranging as part of your room. With Luigi Lo Cascio, Catrinel Marlon, Luigi Maria Burruano.

(Comments wont nest below this level)
fold this thread http://ittakes30.wordpress.com/  Friday, 8 August 2014 o godz. 5:11 pm #  Add karma Subtract karma  +0

Howdy would you mind stating which blog platform
you’re using? I’m looking to start my own blog in the near future but I’m having a
tough time choosing between BlogEngine/Wordpress/B2evolution and Drupal.
Thee reason I ask is because your layout seems different tnen most
blogs and I’m looking for something unique. P.S Apologies for getting off-topic but I had to ask!

(Comments wont nest below this level)
fold this thread weather forecast app  Thursday, 14 August 2014 o godz. 2:27 pm #  Add karma Subtract karma  +0

This paragraph is truly a good one it helps
new net people, who are wishing for blogging.

(Comments wont nest below this level)
fold this thread new games journalism  Thursday, 21 August 2014 o godz. 9:18 pm #  Add karma Subtract karma  +0

You actually make it seem so easy with your presentation but I
find this topic to be actually something which I think I
would never understand. It seems too complex and
very broad for me. I am looking forward for your next post, I will try to get the hang of it!

(Comments wont nest below this level)
Name (required)
E-mail (required - never shown publicly)

Adjust field size: shrink | enlarge)

You can use simple HTML in your comments. Some examples are as follows:
  • A hyperlink: <a href="polishlinux.org">GNU/Linux for everyone!</a>,
  • Strong text: <strong>Strong text</strong>,
  • Italic text: <em>italic text</em>,
  • Strike: <strike>strike</strike>,
  • Code: <code>printf("hello world");</code>,
  • Block quote: <blockquote>Block quote</blockquote>

About the Author

Adam Zielinski

New AdTaily ads!

Are you a film buff?

film buffs community, movie recommendations and reviews

RSS: Comments

You can follow the comments to this article through a special channel RSS 2.0 .

Related articles: CLI

 more »

PolishLinux Top Content

Become our fan on Facebook!

PolishLinux.org on Facebook

Follow PolishLinux on Twitter!

Follow polishlinux on Twitter

Google Ads