|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
|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|
Open console and type on command prompt:
and press Enter.
There are other ways to start mc. If you enter a directory, it will open in that directory
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.
??? Ctrl-Shift-Enter copies full path of selected file in the command line
This section lists keys which are useful to avoid excessive typing when entering shell commands.
- copy the currently selected file name to the command line.
- same a Alt-Enter. May not work on remote systems and some terminals.
- copy the full path name of the currently selected file to the command line. May not work on remote systems and some terminals.
- does the filename, command, variable, username and hostname completion for you.
- C-x t, C-x C-t
- copy the tagged files (or if there are no tagged files, the selected file) of the current panel (C-x t) or of the other panel (C-x C-t) to the command line.
- C-x p, C-x C-p
- the first key sequence copies the current path name to the command line, and the second one copies the unselected panel's path name to the command line.
the quote command can be used to insert characters that are otherwise interpreted by the Midnight Commander (like the '+' symbol)
- Alt-p, Alt-n
- use these keys to browse through the command history. Alt-p takes you to the last entry, Alt-n takes you to the next one.
displays the history for the current input line.
Jul 28, 2019 | klimer.eu
May 1, 2015If you've used an
*nixsystem, 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 (
F8for deleting, etc.) and how to switch panels (ummm, the
mcoffers 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:
- Midnight Commander 4.8.13
- GNU bash 4.2.53
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
mchas the ability to exit to its current directory. Meaning, you can navigate the filesystem using
mc(sometimes it's easier than
cding into that one directory buried deep down somewhere ) and when you quit
F10), your shell will automagically
cdto that directory. This is done thanks to the
mc-wrapperscript 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, launchSelecting files
mc, change to another directory, exit and your shell should be set to that new directory.
Accessing the shell
Ctrl + talternatively) - select files (for example, for copying, moving or deleting).
+- select files based on a pattern.
\- un select files based on a pattern.
*- reverse selection. If nothing was selected, all files will get selected.
Internal viewer (
- There's a shell awaiting your command at the bottom of the screen - just start typing (when no other command dialog is open, of course).
Tabis bound to switching panels (or moving the focus in dialogs), you have to use
Esc Tabto use autocompletion. Hit it twice to get all the possible completions (just like in a shell). This works in dialogs too.
- If you want inspect the output of the command, do some input or just prefer a bigger console, no need to quit
mc. Just hit
Ctrl + o- the effect will be similar to putting
mcin the background but with a nice perk. Your current working directory from
mcwill be passed on to the shell and vice versa! Hit
Ctrl + oagain to return to
Ctrl + Enteror
Alt + Enter- copy the currently selected file's name to the shell.
Ctrl + Shift + Enter- same as above, but the full path is copied.
F3) and editor (
- The internal viewer has many built in modes for "previewing" the content of the file. Try "viewing" a binary, an archive, a DOC document or an image. In some cases, external programs are needed in order for this "previewing" to work.
- If you want to preview the "raw" contents of the file, hit
Shift + F3.
- While the internal viewer and editor are powerful, sometimes you want to use your preferred software ( cough vim cough ). You can do so by setting the
PAGER(for viewer) and
EDITOR(for editor) variables (for example, in your
~/.bashrcfile). Then toggle the
Options -> Configuration -> Use interal edit/viewoption (access the top menu by pressing
Alt + ,- switch
mc's layout from left-right to top-bottom. Mind = blown. Useful for operating on files with long names.
Alt + t- switch the panel's listing mode in a loop: default, brief, long, user-defined. "long" is especially useful, because it maximises one panel so that it takes full width of the window and longer filenames fit on screen.
Alt + i- synchronize the active panel with the other panel. That is, show the current directory in the other panel.
Ctrl + u- swap panels.
Alt + o- if the currently selected file is a directory, load that directory on the other panel and move the selection to the next file. If the currently selected file is not a directory, load the parent directory on the other panel and moves the selection to the next file. This is useful for quick checking the contents of a list of directories.
Ctrl + PgUp(or just left arrow, if you've enabled
Lynx-like motion, see later) - move to the parent directory.
Alt + Shift + h- show the directory history. Might be easier to navigate than going back one entry at a time.
Alt + y- move to the previous directory in history.
Alt + u- move to the next directory in history.
Alt + ?- shows the full Find dialog.
Alt + sor
Ctrl + s- quick search mode. Start typing and the selection will move to the first matching file. Press the shortcut again to jump to another match. Use wildcards (
?) for easier matching.
Virtual File System (VFS)
Ctrl + Space- calculate the size of the selected directories. Press this shortcut when the selection is on
..to calculate the size of all the directories in the current directory.
Ctrl + x s(that is press
Ctrl + x, let it go and then press
s) - create a symbolic link (change
lfor a hardlink). I find it very useful and intuitive - the link will, of course, be created in the other panel. You can change it's destination and name, like with any other file operation.
Ctrl + x c- open the
Ctrl + x o- open the
mchas a concept known as Virtual File System. Try "entering" an archive (
*.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
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 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,
cdto a local directory. Just typing
cdwill 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
Compute totals- so that operations like copy/move have a more detailed progress dialogs.
Equal split- uncheck to define your own ratio for panels. Maybe you prefer one panel bigger than the other? Useful especially if you keep one of the panels in tree mode (or maybe info/quick view, too).
Hintbar visible- one more line available, one less line of noise.
- Panel options
Show backup filesand
Show hidden files- I keep both enabled, as I often work with configuration files, etc.
Lynx-like motion- mentioned above, makes left arrow go to parent directory, while the right arrow enters the directory under selection. Faster than
Enter, etc. This options is quite smart, that is if the shell command line is not empty, the arrows work as usual and allow moving the cursor in the command line.
File typesis useful, as it uses a different color for example for executable files.
Permissions, for me, is not that useful, but I can definitely see it's use, for example, for sysadmins.
- Only one option here,
Skins. You can check out different skins shipped with
mc- just select one from the list. I prefer
gotar, because it plays well with my solarized terminal colors.
- Useful tip - set up a different skin when logged in as the
rootuser. It'll be easier to differentiate between root's and normal user's session, when you're swapping between them (as is often the case).
- Define your own listing mode (
User defined). Hit
F1to see available columns and options.
- Play around in tree mode:
- Compare directories (
Ctrl + x d)
- Fill up the directory hotlist (
Ctrl + \)
Well, that was a lot to take in. Of course, this list is not complete (that's what
man mcis 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!
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:firstname.lastname@example.org To be prompted for your password (still not encrytped) cd /#ftp:email@example.com/home/peavy NOTE: gets you to your home dir directly. **BETTER** - use scp / sftp instead: cd /#sh:firstname.lastname@example.org/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
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.
- Left Options to control the display of the left directory panel
- File Options to manipulate files
- Command Options to edit various mc configuration files
- Options Options to change layout, setup VFS
- Right Options to control the display of the right directory panel
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.
- Help Display in-built mc help.
- 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
- View View the selected file content using mcview, a viewer for midnight commander.
- Edit Edit the selected file using mcedit, an editor for midnight commander.
- 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.,
- RenMov Move/Rename the selected file.
- Mkdir Create a new directory under the selected directory.
- Delete Delete the selected file.
- PullDn This will highlight the Menu Bar. This option is helpful when F9 doesn't work to invoke the menu bar.
- 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:
- C-<chr>: Press Control key and a character key at the same time. For e.g. C-u to swap left and right panels.
- M-<chr>: Press Alt key and a character key at the same time. For Alt key commands, you can also press ESC key, release it and press the character key.
- S-<chr>: Press Shift key and a character key at the same time.
- C-<chr1> <chr2>: Press Control key and a character key at the same time, release it and press another character key again. For e.g. C-x d to compare directories.
Following are some basic keyboard operation
- Tab: To switch from one panel to another.
- M-t: Change the panel display options. i.e Switch from a dual panel display to a single panel display.
- C-s: Search for a file.
- Use up-arrow, down-arrow, page-up, page-down, home and end keys to browse the directory content.
4.Sample mc usage scenarios
- Copy multiple files together using 'Insert' and F5: Highlight a file and press 'Insert' key to tag the file for group selection. Repeat this process for multiple files that you wish to copy. Selected files will be displayed in a different color. Pressing F5 will display the following copy dialog screen, defaulting the destination directory location to the directory displayed in the other panel
Fig: Copy multiple files together using mc UI
- Display additional file information: To display additional file attributes in the directory panels, press F9 -> Left or Right -> Listing Mode, and select "Full File List"
- View the content of any compressed file using F3: Select the file and press F3 to view the content of the file. For e.g. Select a rpm file and press F3, to view the content of the rpm file.
- Toggle between command line and mc using C-o: Press C-o (Control key followed by o) to toggle between full command-line and mc user interface.
- Confirm file operations: To avoid mistakes, enable confirmation for copy, delete, overwrite and execute functions. Press F9 -> Options -> Confirmations, which will display the following screen.
Fig: Setup file operation confirmations
Google matched content
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
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
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 quotes : Somerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose Bierce : Bernard Shaw : Mark Twain Quotes
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
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 DOS : Programming Languages History : PL/1 : Simula 67 : C : History of GCC development : Scripting 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
The Peter Principle : Parkinson Law : 1984 : The Mythical Man-Month : How to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Haters 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|
Last modified: February, 20, 2020