Softpanorama

Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
May the source be with you, but remember the KISS principle ;-)
Skepticism and critical thinking is not panacea, but can help to understand the world better

Cheetsheet for Midnight Commander

News Midnight Commander Recommended Links Midnight Commander cheat sheet by comatory   Mini cheetsheet for Midnight Commander Cheetsheet for Midnight Commander by hunk Cheetsheet for Midnight Commander by Samir Aguiar
mcview Mcedit MC Macro Substitution MC Context Sensitive User Menu External panelize MC Extension menu OFM Book
  color scheme Editor syntax highlighting OFM Standards MC History Tips Etc
  1. Starting Midnight Commander
  2. Navigational and basic hot keys
  3. Command line and shell window
  4. Function Keys
  5. Tree View Panel
  6. Directory Search Panel (aka NCD panel, aka FindFolder)
  7. File/Directories selection/deselection
  8. Quick view
  9. Quick search
  10. FindFile
  11. Command line execution
  12. Sorting directories
  13. User menu script invocation
  14. Additional file commands
  15. Association (extension menu) management
  16. Compare directories
  17. Compare files operation
  18. Built-in Editor
  19. Archive virtual file system
  20. Infopanel and infoline
  21. History and favorites

Starting Midnight Commander

Open console and type on command prompt:

mc

and press Enter.

There are other ways to start mc. If you enter a directory, it will open in that directory

mc ~/.mc

will open the current directory and ~/.mc

mc ~/.mc /usr/share/mc

will open ~/.mc and /usr/share/mc

The first directory will be in the panel you were in the last time you opened mc. e.g. if you left mc with the right panel selected, mc ~/.mc /usr/share/mc will open /usr/share/mc on the left and ~/.mc on the right.

Navigational and basic hot keys

Notes:

Command line and shell window

Function Keys


Top Visited
Switchboard
Latest
Past week
Past month

NEWS CONTENTS

Old News ;-)

[Jul 28, 2019] Use Midnight Commander like a pro

Jul 28, 2019 | klimer.eu

May 1, 2015

If you've used an *nix system, at some point you've stumbled upon Midnight Commander , a file manager based on the venerable Norton Commander. You're probably familiar with the basic operations ( F5 for copying, F6 for moving, F8 for deleting, etc.) and how to switch panels (ummm, the Tab key). But mc offers so much more than that. This article aims to show all the useful (YMMV) shortcuts and functionalities that are often overlooked. Most of them can be accessed using the menu ( F9 ), but who has the time to do that?

Before we get started, let's establish some facts. This article was written and tested on the following software:

Oh, and make sure you're running a modern and UTF-8 friendly terminal - for example, rxvt-unicode.

Hold your horses

There's actually one thing I'd recommend doing before you run mc . mc has the ability to exit to its current directory. Meaning, you can navigate the filesystem using mc (sometimes it's easier than cd ing into that one directory buried deep down somewhere ) and when you quit mc ( F10 ), your shell will automagically cd to that directory. This is done thanks to the mc-wrapper script that should be bundled with your installation of mc . The exact location is dependent on your distribution - in mine (Gentoo) it's /usr/libexec/mc/ , in Ubuntu supposedly it's in /usr/share/mc/bin/ . Once found, modify your ~/.bashrc :

alias mc='. /usr/libexec/mc/mc-wrapper.sh'

Restart your shell, launch mc , change to another directory, exit and your shell should be set to that new directory.

Selecting files Accessing the shell Internal viewer ( F3 ) and editor ( F4 ) Panels Searching files Common actions Virtual File System (VFS)

mc has a concept known as Virtual File System. Try "entering" an archive ( *.tar.gz , *.rpm or even *.jar ) - you'll be able to browse the contents of the archive like a normal folder, without unpacking it first. You extract selected files from the archive by just copying them to the other panel. Bonus points: try "entering" a *.patch file.

This concept is even more powerful when you realize that remote locations can be viewed the same way. A quick way to browse an FTP location is to just cd to it: cd ftp://mirrors.tera-byte.com/pub/gentoo (first Gentoo FTP mirror I found). You'll be able to interact with files as you normally do. To exit this remote location, cd to a local directory. Just typing cd will suffice as it will take you to your home directory.

VFS works for SFTP and Samba shares too. Check the manpages for more information on how to specify user/pass, etc.

Useful options Bonus assignments

Well, that was a lot to take in. Of course, this list is not complete (that's what man mc is there for), but I've selected the commands and functionalities that are the most useful to me . Embrace the ones you find useful, forget the rest and learn about the other ones I've missed!

Midnight Commander Cheat Sheet

Give Me Fish, LLC - Cross-platform C++, Scientific and Technical Programming
Midnight Commander Cheat Sheet
==============================

Ctrl-o	 Toggles to/from cl environment
Ctrl-t	 Toggles a file onto/from the "tagged list"
Ctrl-r	 Refresh both views
Ctrl-l  Reformats the screen (I often need to after opening external files
                           such as PDFs, which cause MC to display strangely.)
Ctrl-u  Swap lhs and rhs panels

Other panel views:
Ctrl-x q    Toggles other panel to/from "quick view". Views text.
Ctrl-x i    Toggles other panel to/from "info view". Views file info.
F3	    Toggles to full panel view of text file.
Ctrl-x t    Copies/pastes the currently selected filename(s) to the cl
            [Effective for using svn commands w/multiple files]
Alt-enter   Copies currently highlighted file to the cl
Ctrl-+	    Prompts for a reg-ex string and selects files based on it
Ctrl-*      Selects all files in cwd
Ctrl-x p    Copies the current directory to the command line 
Ctrl-x s       Creates symlink of the file you're currently on (defaults to
            placing that symlink in the dir in the opposite panel).
Alt-p	    Brings to the CL the previously issued command-line within MC
Alt-n	    Brings to the CL the next issued command-line command within MC
Alt-c	    Allows you to cd while preserving whatever is on the CL
Ctrl-\	    Gets you to hotlist
Esc-tab     Completion for command line (like Bash autocomplete)
Alt-i       CD's the other panel to the current panel's CWD
Alt-o       CD's the other panel to directory you are currently highlighting
cd -        On the command line, type "cd -" to return to the directory you
            were previously in. This is very handy if you accidently change
            directories (eg, sync other pane to same dir as current pane)

Hit return when on an archive library (libMylib.a) and see what object files
  have gone into creating the library.

In order to get a pane as an FTP directory, at the MC command line, type:

cd /#ftp:mpeavy:PASSWORD@teghis.pair.com         NOTE: PASSWORD is not encrytped
cd /#ftp:mpeavy@teghis.pair.com                  To be prompted for your password (still not encrytped)
cd /#ftp:mpeavy@teghis.pair.com/home/peavy       NOTE: gets you to your home dir directly.

**BETTER** - use scp / sftp instead:

cd /#sh:mpeavy@teghis.pair.com/home/peavy       Secure. Also, starts in home

The above ftp/sftp locations can be added to the hotlist.
In configurations, can set to not show backup (~) files.

--------------

Use the External Panelize functions to filter and perform external
 commands multiple times, eg, to view all header files.

Ctrl-x !     - Enter the External Panelize input screen. Choose a command or type
            another command to be executed. 
            Eg: find all header files with:    find . -name *.h
            Save oft-used commands for re-use.
            Will save the output results in the panel you were in.
            To refresh the panel back to the orig. dir view, refresh: Ctrl-r

--------------

Colors (Background, foreground, and transparency)
  http://plug-and-pray.blogspot.com/2009/09/editing-midnight-commanders-color.html
http://my.opera.com/kurzon/blog/2009/08/08/midnight-commander-col

midnight-commander-mc-guide-powerful-text-based-file-manager-for-unix

Section 1 – Menu bar: Located at the top of the screen and has the following options. Press F9 (or) Esc 9 to access the menu bar.


Section 2 – Directory panels: Located in the middle and occupies large part of the screen. By default, it displays both left and right directory browsing panels, where you can view contents of two different directories at the same time.

Section 3 – Function keys: Located at the bottom and has following options. Press Esc key followed by the corresponding menu number to access these functions.

  1. Help – Display in-built mc help.
  2. Menu – Displays user defined menu items. You can create custom menu item to execute some complex steps of operations on the selected file. for e.g. compress the selected file and copy to a remote server with a single click. To edit the menu item file, click F9 (invoke menu bar) -> Command -> Edit Menu File
  3. View – View the selected file content using mcview, a viewer for midnight commander.
  4. Edit – Edit the selected file using mcedit, an editor for midnight commander.
  5. Copy – Copy the selected file. If both panels are displayed, it will copy the file to the other panel. mc will ask for confirmation before doing any changes such as, copy file, delete file, move file etc.,
  6. RenMov – Move/Rename the selected file.
  7. Mkdir – Create a new directory under the selected directory.
  8. Delete – Delete the selected file.
  9. PullDn – This will highlight the Menu Bar. This option is helpful when F9 doesn't work to invoke the menu bar.
  10. Quit – To quite midnight commander, press Esc key followed by 0.


Section 4 – Command Line prompt: Using midnight commander does not take away the command line from power user. You can start typing an Unix command anytime and press enter to execute it. Command line prompt is located towards the bottom of the screen.

3. Basic keyboard shortcuts

Most of the mc keyboard shortcuts fall in one of the following category:

Following are some basic keyboard operation

4.Sample mc usage scenarios

Recommended Links

Google matched content

Softpanorama Recommended

Top articles

Sites

Midnight Commander Cheat Sheet from Give Me Fish, LLC

Midnight Commander keyboard shortcuts ‒ defkey

mc - man pages section 1 User Commands

HOWTO brief mc howto - Porteus



Etc

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


Copyright © 1996-2020 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) in the author free time and without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to make a contribution, supporting development of this site and speed up access. In case softpanorama.org is down you can use the at softpanorama.info

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: February, 20, 2020