Midnight Commander Tips and Tricks

Softpanorama

May the source be with you, but remember the KISS principle ;-)
Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and  bastardization of classic Unix

A good tutorial can be found at Midnight Commander Guide. There is a mail list for MC in which you can ask questions and share tips: https://mail.gnome.org/archives/mc/. There at least a half-dozen of entry level tutorial for Mc on the Web including several YouTube videos (just search for Midnight commander on Youtube):

Visibility of the directory and immediate visual feedback present some of sysadmins blunders and corresponding horror stories. As such mc is highly recommended tool for system administrators.

Some novices complain that mc is just too idiosyncratic for them. Here is a pretty typical lament that the user jhfry wrote in his response to Slashdot story Midnight Commander Development Revived (January 26 2009)

Anyone else regret...
Anyone else regret not getting attached to tools like MC years ago?

There are a few tools that pop up whenever people discuss the easiest or best way to do a task... and I always wish I had made the investment of time to get proficient with those tools. However it almost seems too late.

For example, vi and emacs... I am sure they are great, but the investment of time to get proficient makes it hard to justify even trying. So on my headless linux boxen I use nano, I can do everything I need to do without a cheatsheet.

MC is the same way... I have tinkered with it, but I always found myself exiting to the command line because I would find something I didn't know how to do and didn't want to take the time to figure it out.

Does anyone have any tips on how to best add these types of tools to your tool set when you've mastered an alternative. Simply saying to use it doesn't take into consideration productivity.

Are these tools worth investing personal time into, say instead of studying for a certification or something. Are the gains really that significant?

There is no royal way to mastering of mc. But, truth be told, MC allow "exiting to command line" by just pressing Ctrl-O. Then you can "return" to mc dual panel screen by pressing Ctrl-O another time. That means that you can gradually learn the ropes and at the beginning to use mc  just as a tool to see the currently directory with one click. The guy in the post reproduced above also failed to understand the simplest thing: that the bar below contains the main commands (so called F-commands which can be invoked by functional keys F1-F10) and this bar items are clickable by mouse. That probably represents level-zero of usage of mc.

It would be better if MC exported its macros to environmental variables in the shell so that you can operate with the current file, directory in the passive panel and the current file in the passive panel via macros like in mc command line:

  1. %f -- The current file name. %F -- The current file in the passive panel.
  2. %d -- The current directory name. %D -- The directory name of the passive panel.
  3. %t -- The currently tagged files. %T -- The tagged files in the passive panel.

But this export can be emulated "seamlessly" if you program macro in  programmable keyboard or keypad.For example, Logitech G110 gaming keyboard or, better, Logitech G13 Programmable Keypad with LCD Display (which can be used with any keyboard). You can also create a user menu item that writes the content of those macros your home directory in a form of export statements and then "source" this file in your bashrc.

At the same time,  you can't get far in mastering mc without investing some time experimenting with it and reading documentation.  It is a different paradigm of working with shell (see Orthodox system interface ). But there is some critical mass of efforts after which you do start doing operation of "subconscious" level, as a part of your motor skills, and they become a part of you "kinetic memory".  You now can execute some typical sequences of keystroke semi-automatically, like a good piano player. And that's the goal.

I still remember this "I got it" moment and after that I just could not understand why initial learning was so difficult for me (I came to NC from Xtree).  In other words you need a critical mass of investment in time and effort that will be handsomely paid off.  And the the main advantage on investing time and energy is MC is that it probably will be available for the rest of your life

For example, I use OFMs since 1989. That's almost 30 years and those skills that I acquired in 1989 with NC 2.0 are still by-and-large valid. This is not the case with most commercial products, which that often are discontinued or changed in such a way to make previous skills obsolete for facilitate upgrades. MS Word is one good example here. Few skills acquired with MS Word 5.0 for DOS (I typeset a book using MS Word 5.0, so I did make a huge investment is acquiring MS Word skills) are valid now. And this is not a completely bad application, where the key ideas preserved, albeit in crippled and somewhat perverted form.  Although in the most recent version (Office 365)  Microsoft  managed to screw up even basic functionality of MS Word. But at least a decent versions like MS Word 2007  still exists, so effort of learning it still pays.  How long nobody knows.  And that's the problem. With MC you can be pretty sure enjoy the same interface and functionality in 2050 if you live that long ;-)

With programmer editors the situation might be worse. While it is an essential instrument of programmer and learning programmable editor with macro language pays many time, the survival rate of such editors is low, if we are talking about timespan of more then 20 years. For example both the Kedit and MultiEdit are not abandonware:

  1. An excellent editor DOS and then Windows 3.1 editor MultiEdit. It barely survived.  The most recent release is dated from 2008. As of 2011, it was one of the few surviving editors from the DOS era when text editors were regarded as indispensable programming tools.
  2. An excellent editor for Windows 3.1 Kedit, which is a derivative of IBM Xedit. KEDIT first became available in 1983. It is derivative of Xedit from VM/CMS OS, and it has very good Unix implementation THE editor.

There are very few editors that survived from the time of PC revolution when DOS ruled the globe (let's say from 1986) for 30 years. Among them:

  1. VI
  2. Emacs

While mcedit, a built-in  editor is far from the power of, say, Kedit it is  a much  better deal then nano. for example it allow to edit multiple files simultaneously and move "selection" between them with ease.

In a way users, who do not want to invest time and energy into learning mc are hopeless. Like old English proverb aptly states  "Nothing venture, nothing have." (Noght venter noght haue. [1546 J. Heywood Dialogue of Proverbs i. xi. E1]). That's the main tip for those who want to master mc ;-).

You need to take some steps to make MC to exit in the current directory visible on the screen. One way is to use alias such as

alias mc='mc -P "/tmp/mc-$USER/mc.pwd.$$"; cd `cat /tmp/mc-$USER/mc.pwd.$$`; rm /tmp/mc-$USER/*'

The other is to use a supplied with mc more generic script

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

One of the most common problems with mc is incorrect display of pseudo-graphical characters, which spoils borders on the panels and while this defect does not affect functionality, is very unpleasant aesthetically. See Midnight commander does not display pseudo-graphic characters properly for more information. You can use option -a to use regular characters instead and in most cases this is an adequate solution.

Another possible fix that sometimes work is to try using LANG=C mc instead of mc.

  • Please, a small question - I made the new installation (FC3, KDE) and run MC (the great SW!!). Everything works, except that borders on  the panels are drawn by 'a umlaut' instead of pseudo-graphic (lines)
    • This is a locale and termcap issue which I do not fully understand.
      Fortunately I do know a workaround. :) Use this:
    • LANG=C mc

Other common issues and little know features: 

  • You can change sizes of each panel making them asymmetrical, which is useful for displaying long names via Options/Layout/Panel_split. I find useful 33%/66% split so that light panel is approximately twice larger then the left.
    • You can also change from vertical split to horizontal one, in which the width of each panel is equal to the width of the terminal screen.  that allows to display usner and permissions in wider panel.
  • Ctrl-O opens shell prompt.  Another Ctrl-O return panels.
  • Strings that you copied on any of the panels can be pasted to the command line.
  • MC simplified using "safe" editing of files: make a backup, copy it to some directory, edit it, test it and then copy back. This is important when working on remote servers when you blunder might means a trip of say 100 miles in the most inopportune moment. See Sysadmin Horror Stories
  • To copy the name of the current file into the command like instead of Alt-Enter (put the current file in the command line) you can use Esc-Enter (this is useful for Cygwin as Windows uses Alt-Enter for maximizing screen, and this is a useful shortcut to disable)
  • Recommended fonts for Midnight commander
    • For Cygwin you can use Fixedsys 11
    • terminus is the best font for linux
  • Multi-screen feature: support of many opened editors and viewers (#1490)
    You can concurrently run multiple viewers and editors (screens). Use following default hotkeys:
    shortcut description
    Meta + ` Show list of screens: viewers, editors and file panel
    Meta + { Switch to previous screen
    Meta + } Switch to next screen

TIP: Often you need to use "learn key functionality to enable some keys on your keyboard (for example Grey + and grey - ). You need to save the results of leraning for them to work, so don't forget to get to save menu and press enter at then end of this exercise.

  • Home, or Alt-< - move to the top of the directory listing
  • End, or Alt-> - move to the end of the directory listing
  • Ctrl-X V, or Ctrl-X S create symbolic link
  • Alt-C or Esc-C -- quick cd (opens a box with history of previous directories and selecting them is quicker to type than retyping.
  • Ctrl-O -- Hide panels and expose command window.
  • Ctrl-U -- Swap left and right panel
  • Space Toggle tick boxes ++++++++-++on or off
  • Tab key also moves sequentially through fields of selection boxes
  • Ins or Ctrl-T -- select file (actually this is a toggle)
  • Ctrl-R -- refresh or rescan directory view
  • Alt-shift ? -- find file (also available from top menu F9/command/find file)
  • Ctrl-X D -- compare directories (release ctrl-x before pressing d)
  • Ctrl-X I information about file
  • Ctrl-X X,L -- symlink, link file
  • Shift-Grey+ or Shift + -- select group. Can enter wildcards to highlight a certain type or name of file.
  • Shift-Grey- or Shift - -- deselect group.
  • Grey* or Shift * - reverse selection. Changes highlighting to all unselected files. Handy to use these two in combination if you are trying to quickly select all but a certain group.
  • Shift-* select all /deselect all (toggle)
  • Ctrl-X-C -- built-in graphic chmod command,
  • Ctrl-X-O -- built-in graphic chown command
  • Alt-O or Esc-O make passive panel directory equivalent to the active.
  • Shift + - select group. Can enter wildcards to highlight a certain type or name of file.
  • Shift * - reverse selection. Changes highlighting to all unselected files. Handy to use these two in combination if you are trying to quickly select all but a certain group.
    • \ - unselect group. Opposite of +.

As most sysadmin now access servers using Windows desktop and terminal emulator, usage of programmable keyboard can dramatically increase your productivity.

I would recommend Logitech G510s gaming keyboard  It provides 18 macro keys and allows LUA scripting  for macros. Macros can help to solve some nasty problems with MC. For example MC does not export the values of macrovariables to shell window when you press Ctrl-O. But using programmable keyboard you can create a macro and assign it to say key G18 which:

  1. Runs user command assigned to say letter e (F2-e) that export value of all macro variable into export statements and write this file to your home directly under some fixed name or the current date and session id (if you use multiple sessions). For example
    export f="'%f'" > ~/mv_env
    export D="'%D'" >> ~/mv_env
    export t="'%t'" >> ~/mv_env
    ... ... ...
    Please note that the current directory of the active panel corresponds to the value of $PWD. you you do not need to export it. You can also create a loop to accomplish the same with less number of lines.
     
  2. Presses Ctrl-O and then executes dot command on this newly created file
    . ~/mv_env

    (you can alias it to .m; just add alias .m='. ~/mc_env' to your profile )

After that all MC built-in macros are available for usage in commands and scripts as env variables.
  • Ctrl \ -- open directory hotlist
  • Ctrl-X H -- add directory top hotlist

There are several types of history in mc. It is present if you can see the pictogram [^]  (usually on the right side). for example there is:

History on command entered on the command like

History of directories visited (separate for left and right panels)

History is persistent from one invocation to another. You case see it by clicking with  mouse  [^] in the right bottom corner of mc.

  • For directories history and whenever it is present Alt-y moves to the previous directory in the history, equivalent to clicking the < with the mouse.
  • Alt-u moves to the next directory in the history, equivalent to clicking the > with the mouse.
  • Alt-Shift-h, Alt-H displays the directory history, equivalent to depressing the 'v' with the mouse.
  • 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.
  • Alt-h displays the history for the current input line.
  • Instead of Alt-Enter (put the current file in the command line) you can use Esc-Enter (this is useful for Cygwin as Windows uses Alt-Enter for maximizing screen, and this is a useful shortcut to disable)
  • You can add the path from the active and passive panels Ctrl-X P and Ctrl-X Ctrl-P. Pasting the file name is Ctrl-X T. There is a quick cd command (which in version 4.8.1 can be used to rsync panel directory with shell terminal screen directory.
  • You can use macrovariables in the command string (see below).
  • Click on [^] at the right corner of command line shows history of commands, which is browsable.  (also availbel via menu F9/Ccommand/FCommand history)
  • Hitting Ctrl-O in viewer and editor expose console screen and allow typing commands in it.

  • Alt-O -- Switch to the directory on the passive panel identical to the directory on the active panel hotkey

  • Equlize directories on both  panels --  put the directory on active panel in the holist and then switch to the other panel and retrieve it.

  • Tab, ArrowUp, ArrowDn or Ctrl-I moves from one menu field to another ArrowUp or ArrowDown and Enter, or use the 'hotkey' - the highlighted letter in each menu item.
  • F10 closes menu
  • ArrowLeft, ArrowRight, Home, End help to navigate entered string
  • Mouse click on [^] produces history, Esc close the history

The directory listing can be displayed in several different formats. Pressing Alt-t to cycles through them. There are

  • Full: gives a standard view.

  • a dual column format,

  • Long: a format resembling the output of ls -l called full (single column on the screen)  shows permissions, ownership and long file names in full, but removes the other pane to make space.

  • Custom, where you can define fields to be displayed (press F1 to see proper name when you at this tab). See Creating  Custom Format

Listing Mode allows you to change how your directory is displayed. Brief: shows contents in two columns on that pane.

You can also cycle through these views by using Alt - t.
 

In Listing Mode, tick "User Mini Status" which will handily display the permissions of the presently highlighted file or directory within the separate line at the bottom of the panel.

There is also an "information mode." This will display detailed file system information in the other panel about the selected item in the current panel. To invoke this mode, type Ctrl-x i. To return the other panel to its normal state, type Ctrl-x i again.

You can create your own format. Some userful keywords for custom fields are

  • size

  • mtime

  • owner

  • group

  • perm

you can also change  format of the summary line. it makes sense to display owner and permissions

You can adjust the displayed digits with the column size option, see the “Listing mode” section in the manual. The file to edit is ~/.config/mc/panels.ini.

To list the file sizes as K, M or G use a narrow size column using the user_format key:

[New Left Panel]
user_format=half type name mark size:4 space mtime

If you want the size without abbreviation, reserve enough space for it:

[New Right Panel]
user_format=half type name mark size:16 space mtime
From the manual:

Listing Mode...

The listing mode view is used to display a listing of files, there are four different listing modes available: Full, Brief, Long and User. The full directory view shows the file name, the size of the file and the modification time.

The brief view shows only the file name and it has from 1 up to 9 columns (therefore showing more files unlike other views). The long view is similar to the output of "Is -1" command. The long view takes the whole screen width.

If you choose the "User" display format, then you have to specify the display format.

The user display format must start with a panel size specifier. This may be "half" or "full", and they specify a half screen panel and a full screen panel respectively.

After the panel size, you may specify how many listings to fit in the panel, side-by-side (in other words: how many times to repeat the fields horizontally). This defaults to 1. You may change this by adding a number from
1 to 9 to the format string.

After this you add the name of the fields with an optional size specifier. This
are the available fields you may display:

  1. name displays the file name.
  2. size displays the file size.
  3. bsize is an alternative form of the size format. It displays the size of the files and for directories it just shows SUB-DIR or UP--DIR.
  4. type displays a one character wide type field. This character is similar to what is displayed by Is with the -F flag - * for executable files, / for directories, @ for links, = for sockets, - for character devices, + for block devices, I for pipes, ~ for symbolic links to directories and ! for stale symlinks (links that point nowhere).
  5. mark an asterisk if the file is tagged, a space if it's not.
  6. mtime file's last modification time.
  7. atime file's last access time.
  8. ctime file's status change time.
  9. perm a string representing the current permission bits of the file
  10. mode an octal value with the current permission bits of the file.
  11. nlink the number of links to the file.
  12. ngid the GID (numeric).
  13. nuid the UID (numeric).
  14. owner the owner of the file.
  15. group the group of the file.
  16. inode the inode of the file.

Also you can use following keywords to define the panel layout:

  • space a space in the display format.
  • | add a vertical line to the display format.

To force one field to a fixed size (a size specifier), you just add : followed by the number of characters you want the field to have. If the number is followed by the symbol +, then the size specifies the minimal field size - if

the program finds out that there is more space on the screen, it will then expand that field.

For example, the Full display corresponds to this format:

half type name | size | mtime

And the Long display corresponds to this format:

full perm space nlink space owner space group space size space mtime space name

This is a nice user display format:

half name I size:7 | type mode:3

Few people understand that you you can pipe output of any command into viewer with Alt-!. That make viewing logs more eeffficent

Ctrl-O in viewer and editor hide the window and exposes the console screen.

  • Ctrl-X-Q Quick viewer
  • Ctrl-X-I -- information about file is quick view window
  •  allows to execute arbitrary Unix command and pipe output into built-in viewer.
  • Alt-! The viewer supports "/" and "?" for regex search, the hotkeys that are standard for many Unix utilities (vi, less, etc).
  • F3 in viewer exits the viewer. That seems to be a minor thing but this feature proved to be very useful and I recommend it as a standard key binding for viewer in any OFM.

  • Ctrl-O in viewer and editor hide the window and exposes the console screen.
  • Multi-screen feature: support of many opened editors and viewers (#1490) Here Meta means Alt key as PC keyboard lack proper meta key.
    You can concurrently run multiple viewers and editors (screens). Use following default hotkeys:
    shortcut description
    Meta + ` Show list of screens: viewers, editors and file panel
    Meta + { Switch to previous screen
    Meta + } Switch to next screen

Few people understand the mcedit has multiwindow capability. After you open it with you first file you can open another files using editor menu and then you can "cat and paste" fragments of text between them with ease using save selection to the clipfile feature (Edit/Save to clipfile) and then switch to the second window and paste from the clipfile in the point you need this selection. 

Ctrl-O in editor hide the window and exposes the console screen.

  • Selection using mouse (F3 key usage is somewaht awkward)
  • Ability to save selection to a file and inset this file into another window (possibly using macro)
  • Built-in internal editor user menu. Key panel elements (current file on active panel, the current file on passive panel, path to active panel, path to passive panel, highlighted files on active/passive panel, etc) are exportable to the editor as macrovariables and can be inserted into the text via editor user menu. See mcedit for details
  • Alt-b Hotkey for finding matching bracket is
  • Ctrl-O in viewer and editor hides the editor window and exposes the console screen.
  • Multi-screen feature: support of many opened editors and viewers (#1490)
    You can concurrently run multiple viewers and editors (screens). Use following default hotkeys:
    shortcut description
    Meta + ` Show list of screens: viewers, editors and file panel
    Meta + { Switch to previous screen
    Meta + } Switch to next screen

You can open the editor in a separate windows if you use screen or tmux. To accomplish this you need create a bash script, not a function. Then set EDITOR value to it, for example:

$ cat ~/myEditor.sh
#!/bin/sh
tmux new-window "vim $1"
export EDITOR=~/myEditor.sh

 mcdiff - Internal diff viewer of GNU Midnight Commander

Jun 13, 2018 | www.systutorials.com

mcdiff: Internal diff viewer of GNU Midnight Commander. Index of mcdiff man page
Read mcdiff man page on Linux: $ man 1 mcdiff NAME mcdiff - Internal diff viewer of GNU Midnight Commander. USAGE mcdiff [-bcCdfhstVx?] file1 file2 DESCRIPTION

mcdiff is a link to mc , the main GNU Midnight Commander executable. Executing GNU Midnight Commander under this name requests starting the internal diff viewer which compares file1 and file2 specified on the command line.

OPTIONS
-b
Force black and white display.
-c
Force color mode on terminals where mcdiff defaults to black and white.
-C =,,:= ...
Specify a different color set. See the Colors section in mc (1) for more information.
-d
Disable mouse support.
-f
Display the compiled-in search paths for Midnight Commander files.
-t
Used only if the code was compiled with S-Lang and terminfo: it makes the Midnight Commander use the value of the TERMCAP variable for the terminal information instead of the information on the system wide terminal database
-V
Displays the version of the program.
-x
Forces xterm mode. Used when running on xterm-capable terminals (two screen modes, and able to send mouse escape sequences).
COLORS The default colors may be changed by appending to the MC_COLOR_TABLE environment variable. Foreground and background colors pairs may be specified for example with:
MC_COLOR_TABLE="$MC_COLOR_TABLE:\
normal=lightgray,black:\
selected=black,green"
FILES /usr/share/mc/mc.hlp
The help file for the program.

/usr/share/mc/mc.ini

The default system-wide setup for GNU Midnight Commander, used only if the user's own ~/.config/mc/ini file is missing.

/usr/share/mc/mc.lib

Global settings for the Midnight Commander. Settings in this file affect all users, whether they have ~/.config/mc/ini or not.

~/.config/mc/ini

User's own setup. If this file is present, the setup is loaded from here instead of the system-wide startup file.

Creative use of user menu

There is a very simple test that allow you to distinguish advance mc user from a novice. Ask him/her to press F2 and show you the user menu. If the user menu is default this is a novice.

Despite being very basic MC user menu is  a very powerful tool that allow to code many typical operation which became available to you with just two keystrokes.The following macrovariables(you can use them both in your own user menu entries and on command line) are available (See also MC Macro Variables ):

  1. %f The current file name. %F The current file in the passive panel.
  2. %d The current directory name. %D The directory name of the passive panel.
  3. %t The currently tagged files. %T The tagged files in the passive panel.
  4. "%u" and "%U" Similar to the %t and %T macros, but after the operation all the files are untagged (can be used only once per menu entry).
  5. %s and %S The tagged files if there are any. Otherwise the current file.
  6. %cd This is a special macro that is used to change the current directory to the directory specified in front of it. This is used primarily as an interface to the VFS.
  7. %view the invocation of the internal viewer
  8. "%%" The % character
  9. "%{Enter some text}" Prompt for the substitution (in the example given, the prompt will be "Enter some text"), each time the command is executed.

"Learn macrovariables" is a great tip. For example to symlink the file to opposite pane you can add  to the user menu with just a couple of lines  (for example with the short key l):

l	Symlink the current file to the directory in opposite (passive) panel
	ln -s %d/%p $D/%p

Similarly you can create a shortcut for creating "in-place" backup of the file:  

b	Create a time stamped backup is the same directory
	cp %f %f.`date +"%y%m%d"`

I recommend to print your mc.menu file and put in it above your monitor for reference. Details of how to write user menu items are in   provides in MC Context Sensitive User Menu

Mc is also great for working with tar files, gzip and zip archives.

Additional way of integration with the underling OS shell via so called User menu and extension menu using the same set of macro variables that are available for command line. This way "user menu" provide a user with he capability to write his own simple extensions some of which can be quite useful. Here is an example taken from Midnight Commander User menu (which has a unique feature that it is dynamic and only those items of the menu that are applicable to the current file type and presence/absence of selected files are shown to the user): 

= t r
+ ! t
y       Gzip or unzip current file
        unset DECOMP
	case %f in
	    *.gz) DECOMP=-d;;
	    *.[zZ]) DECOMP=-d;;
	esac
        gzip $DECOMP -v %f
+ t t
Y       Gzip or gunzip tagged files
        for i in %t
        do
          unset DECOMP
	  case "$i" in
	    *.gz) DECOMP=-d;;
	    *.[zZ]) DECOMP=-d;;
	  esac
          gzip $DECOMP -v "$i"
        done
+ f \.tar.gz$ | f \.tgz$ | f \.tpz$ | f \.tar.Z$ | f \.tar.z$ | f \.tar.bz2$ | f \.tar.F$ & t r & ! t t
z       Extract compressed tar file to subdirectory
	unset D
	set gzip -cd
	case %f in
	  *.tar.gz) D="`basename %f .tar.gz`";;
	  *.tgz)    D="`basename %f .tgz`";;
	  *.tpz)    D="`basename %f .tpz`";;
	  *.tar.Z)  D="`basename %f .tar.Z`";;
	  *.tar.z)  D="`basename %f .tar.z`";;
	  *.tar.bz2) D="`basename %f .tar.bz2`"; set bunzip2 -c ;;
	  *.tar.F) D="`basename %f .tar.F`"; set freeze -dc;
	esac
	mkdir "$D"; cd "$D" && ("$1" "$2" ../%f | tar xvf -)
+ t t
Z       Extract compressed tar files to subdirectories
	for i in %t
        do
	  set gzip -dc
          unset D
	  case "$i" in
	    *.tar.gz)  D="`basename $i .tar.gz`";;
	    *.tgz)     D="`basename $i .tgz`";;
	    *.tpz)     D="`basename $i .tpz`";;
	    *.tar.Z)   D="`basename $i .tar.Z`";;
	    *.tar.z)   D="`basename $i .tar.z`";;
	    *.tar.F)   D="`basename $i .tar.F`"; set freeze -dc;;
	    *.tar.bz2) D="`basename $i .tar.bz2`"; set bunzip2 -c;;
          esac
	  mkdir "$D"; (cd "$D" && "$1" "$2" "../$i" | tar xvf -)
        done

This idea of user menu was extended to the mc internal editor which has an additional macro variable %b to which you can direct the output of shell command for insertion into editor buffer and vise versa. 

This is a valuable innovation. Generally in version 4.8.1 editor looks more promising and more modern then in previous version although it still is lack in quality and capabilities in comparison with FTE (while having some unique features).

  • Multi-screen feature: support of many opened editors and viewers  instead of one (#1490)
    You can concurrently run multiple viewers and editors (screens). Use following default hotkeys:
    shortcut description
    Meta + ` Show list of screens: viewers, editors and file panel
    Meta + { Switch to previous screen
    Meta + } Switch to next screen
  • "External panelize" command (executing an arbitrary command and putting the resulting file listing in a panel, so that it can be used for navigating. This was really great idea that was still never implemented in other OFMs. MC implementation need capabilities of hiding full path like in FAR.
  • Columns in the panels can be sorted using mouse click like in Total Commander (version 4.7 and later).
  • Context-sensitive, dynamic user menu based on "visibility predicates". MC pioneered concept of context-sensitive user menu items. Each item has it's "visibility predicate" which determine conditions under which the this item will be displayed in the menu.
  • You can assign viewer and editor for files with given extension (for example .pdf) via extension menu. Both can be assigned depending on the result of a predicate (or even script) evaluation. Script can filter the file before passing it to the viewer (very useful for viewing log files). Concept of "actions" was introduced in extension menu. So pressing F3 is one action, while pressing F4 is another, and pressing Enter is yet another one. You can assign a program for each action (viewer for F3, editor for F4 and so on for files with given extension (for example .pdf) via extension menu.Both can be assigned depending on the result of a predicate (or even script) evaluation. Script can filter the file before passing it to the viewer (very useful for viewing log files)
  • "History of everything" and command completion in all dialogs. That's really highly helpful feature for advanced users.
    • History of commands entered in command line is available by clicking [^] in the right corner with the mouse.
  • Mouse drag and drop is working even in Teraterm (4.8 and later versions)
  • Better than in previous versions implementation of command console interface (4.8 and later versions). Probably the first support of "real" Unix console via "Ctrl-O". Addition of path from the left and right panels (Ctrl-[ and Ctrl-]) were implemented as Ctrl-X P and Ctrl-X P. Pasting the file name (Ctrl-I) is Ctrl-X T. There is also a hotkey for active panel directory path Alt-A and for quick cd command.Paradoxically before MC 4.8 using OFMs were extremely weak in this area as if programmers who wrote them were completely limited to Windows experience and did not understand of value of integration of shell and file manager the OFM support.
  • Correct implementation of Ctrl-O functionality in viewer and editor -- editor or viewer are hidden and console screen is exposed.
  • Full power of regular expressions in selections and search. For example, in panel selections the list "*.txt; *.bat; *.inf; *.doc" can be specified as "*.(doc|bat|inf|doc)".
  • RegEx-based search capabilities. Like in NC5, XTree "flat" VFS can be emulated in MC using panelize command (search for *), but without macros this emulation is pretty painful.
  • Dynamic construction of the directory tree. The idea itself is rather interesting taking into account the real height of directory tree that we see in Red Hat and other Linux distributions with Gnome installed. But unfortunately the existing implementation breaks OFM doctrine as the tree is build from root, not from the current directory and that somewhat limits its usability for quick search of files and navigation. The directory tree expand/collapse should happens automatically in the vicinity of the user view on the tree. Currently you need manually use F2 (rescan) to open the branch that interests you. Still the problem here is the cost of full scanning of the tree in a typical unix system.
  • Configurable display information (you can select your own directory display format)
    • The circular ring of predefined display formats switchable via Alt-T.
  • Attempts to provide some hotkeys for working with the current directory. Jumping to the top file, middle file and the last file on the panel are provided (only Alt-G (the top) and Alt-J (the bottom) actually work now); That can be extended to potentially more useful jumps to the top subdirectory, middle subdirectory and the last subdirectory in the current panel (often there are only two or three subdirectories; in this case those three keys select subdirectory unambiguously).
  • Dynamic Bottom Toolbar. MC 4.6.0 is probably the only Unix OFMs that supports the concept of dynamic toolbar (in Viewer, Editor, and Directory Search panel).. Dynamic toolbar is a very useful instant help system and should be used whenever possible. Unfortunately, the key bar doesn't change when Alt, Ctrl, or Shift are pressed like in FAR and FC. It's probably hard to implement it in a portable way in Unix with its limited PC keyboard support.
  • Ctrl-x-v -- create symbolic link
  • Instead of Alt-Enter (put the current file in the command line) which often does not work, you can use Esc-Enter. This tip works for other shortcuts too.
  • This idea of user menu was extended to the mc internal editor which has an additional macro variable %b to which you can direct the output of shell command for insertion into editor buffer and vise versa.  This is a valuable innovation. Generally in version 4.8.1 editor looks more promising and more modern then in previous version although it still is lack in quality and capabilities from FTE, which I strongly recommend as an external editor for Midnight Commander.
Top Visited
Switchboard

[May 10, 2021] The Tilde Text Editor

Highly recommended!
This is an editor similar to FDE and can be used as external editor for MC
May 10, 2021 | os.ghalkes.nl

Tilde is a text editor for the console/terminal, which provides an intuitive interface for people accustomed to GUI environments such as Gnome, KDE and Windows. For example, the short-cut to copy the current selection is Control-C, and to paste the previously copied text the short-cut Control-V can be used. As another example, the File menu can be accessed by pressing Meta-F.

However, being a terminal-based program there are limitations. Not all terminals provide sufficient information to the client programs to make Tilde behave in the most intuitive way. When this is the case, Tilde provides work-arounds which should be easy to work with.

The main audience for Tilde is users who normally work in GUI environments, but sometimes require an editor for a console/terminal environment. This may be because the computer in question is a server which does not provide a GUI, or is accessed remotely over SSH. Tilde allows these users to edit files without having to learn a completely new interface, such as vi or Emacs do. A result of this choice is that Tilde will not provide all the fancy features that Vim or Emacs provide, but only the most used features.

News Tilde version 1.1.2 released

This release fixes a bug where Tilde would discard read lines before an invalid character, while requested to continue reading.

Tilde version 1.1.1 released

This release fixes a build failure on C++14 and later compilers

[Apr 03, 2020] Use Midnight Commander like a pro by Igor Kilmer

Apr 03, 2020 | klimer.eu

Panels

  • 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.
Common actions
  • 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 s to l for 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 chmod dialog.
  • Ctrl + x o - open the chown dialog.

Panel options

  • Show backup files and 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 Home , Enter , Home , 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.
Bonus assignments
  • Define your own listing mode ( Right/Left -> Listing mode... -> User defined ). Hit F1 to see available columns and options.
  • Play around in tree mode: Right/Left -> Tree or Command -> Directory tree .
  • Compare directories ( Ctrl + x d )
  • Fill up the directory hotlist ( Ctrl + \ )

[Mar 05, 2020] Using Ctags with MC

Mar 05, 2020 | frankhesse.wordpress.com

the Midnight Commander's built-in editor turned out to be. Below is one of the features of mc 4.7, namely the use of the ctags / etags utilities together with mcedit to navigate through the code.

Code Navigation
Training
Support for this functionality appeared in mcedit from version 4.7.0-pre1.
To use it, you need to index the directory with the project using the ctags or etags utility, for this you need to run the following commands:

$ cd /home/user/projects/myproj
$ find . -type f -name "*.[ch]" | etags -lc --declarations -

or
$ find . -type f -name "*.[ch]" | ctags --c-kinds=+p --fields=+iaS --extra=+q -e -L-

')

me marginwidth=


After the utility completes, a TAGS file will appear in the root directory of our project, which mcedit will use.
Well, practically all that needs to be done in order for mcedit to find the definition of the functions of variables or properties of the object under study.

Using
Imagine that we need to determine the place where the definition of the locked property of an edit object is located in some source code of a rather large project.


/* Succesful, so unlock both files */
if (different_filename) {
if (save_lock)
edit_unlock_file (exp);
if (edit->locked)
edit->locked = edit_unlock_file (edit->filename);
} else {
if (edit->locked || save_lock)
edit->locked = edit_unlock_file (edit->filename);
}

me marginwidth=

To do this, put the cursor at the end of the word locked and press alt + enter , a list of possible options appears, as in the screenshot below.
image

After selecting the desired option, we get to the line with the definition.

[Mar 05, 2020] How to switch the editor in mc (midnight commander) from nano to mcedit?

Jan 01, 2014 | askubuntu.com

Ask Question Asked 9 years, 2 months ago Active 6 months ago Viewed 123k times

https://tpc.googlesyndication.com/safeframe/1-0-37/html/container.html

sdu ,

Using ubuntu 10.10 the editor in mc (midnight commander) is nano. How can i switch to the internal mc editor (mcedit)?

Isaiah ,

Press the following keys in order, one at a time:
  1. F9 Activates the top menu.
  2. o Selects the Option menu.
  3. c Opens the configuration dialog.
  4. i Toggles the use internal edit option.
  5. s Saves your preferences.

Hurnst , 2014-06-21 02:34:51

Run MC as usual. On the command line right above the bottom row of menu selections type select-editor . This should open a menu with a list of all of your installed editors. This is working for me on all my current linux machines.
You can also change the standard editor. Open a terminal and type this command:
sudo update-alternatives --config editor

You will get an list of the installed editors on your system, and you can chose your favorite.

AntonioK , 2015-01-27 07:06:33

If you want to leave mc and system settings as it is now, you may just run it like
$ EDITOR=mcedit

> ,

Open Midnight Commander, go to Options -> Configuration and check "use internal editor" Hit save and you are done.

[Aug 20, 2019] Fixing Midnight Commander's unreadable dropdown menus

Apr 24, 2011 | tech.iprock.com
Skip to content April 24, 2011 by Admin
Important This is an edited version of a post that originally appeared on a blog called The Michigan Telephone Blog, which was written by a friend before he decided to stop blogging. It is reposted with his permission. Comments dated before the year 2013 were originally posted to his blog.

If you've installed Midnight Commander and haven't changed the default colors, when you try to access a dropdown menu you may see this:

Midnight Commander -- Original Colors

REALLY hard to read that menu, isn't it? Wouldn't you rather see this?

Midnight Commander -- Changed Colors

To fix the unreadable menus, just make sure Midnight Commander is not open, then use any text editor (such as nano) to open ~/.mc/ini:

nano ~/.mc/ini

Assuming that there is no existing [Colors] section in the file, just add this at the bottom of the file (if the second line exceeds the blog column width, just use copy and paste to get it all):

[Colors] base_color=default,default:menu=black,cyan:menuhot=brightmagenta,cyan:menusel=white,blue:menuhotsel=brightmagenta,blue

If there is an existing [Colors] section, you can try tweaking it using the parameters shown above. If you have a very recent version of Midnight Commander (which you probably will have if you are running Ubuntu), then instead of menu= you'll need to use menunormal= , as shown here:

[Colors] base_color=default,default:menunormal=black,cyan:menuhot=brightmagenta,cyan:menusel=white,blue:menuhotsel=brightmagenta,blue

Note that for some reason the base_color parameter must appear, or the other items are ignored. Save the change, exit the editor, and open Midnight Commander. If you then close Midnight Commander, you may find that the position of the [Colors] section has moved within the ini file -- apparently Midnight Commander rewrites the file when you close it -- but if you don't like the changes you can remove the [Colors] section to reverse the change.

I figured out how to do this after reading this blog post:
Ajnasz Blog – Midnight Commander colors and themes
Another source of information is:
Zagura's blog – Midnight Commander Color Themes

Related Posts

[Aug 20, 2019] Midnight Commander, using date in User menu

Dec 31, 2013 | unix.stackexchange.com

user2013619 ,Dec 31, 2013 at 0:43

I would like to use MC (midnight commander) to compress the selected dir with date in its name, e.g: dirname_20131231.tar.gz

The command in the User menu is :

tar -czf dirname_`date '+%Y%m%d'`.tar.gz %d

The archive is missing because %m , and %d has another meaning in MC. I made an alias for the date, but it also doesn't work.

Does anybody solved this problem ever?

John1024 ,Dec 31, 2013 at 1:06

To escape the percent signs, double them:
tar -czf dirname_$(date '+%%Y%%m%%d').tar.gz %d

The above would compress the current directory (%d) to a file also in the current directory. If you want to compress the directory pointed to by the cursor rather than the current directory, use %f instead:

tar -czf %f_$(date '+%%Y%%m%%d').tar.gz %f

mc handles escaping of special characters so there is no need to put %f in quotes.

By the way, midnight commander's special treatment of percent signs occurs not just in the user menu file but also at the command line. This is an issue when using shell commands with constructs like ${var%.c} . At the command line, the same as in the user menu file, percent signs can be escaped by doubling them.

[Aug 10, 2019] LinuxQuestions.org - [SOLVED] Midnight Commander Help

Aug 10, 2019 | www.linuxquestions.org
CrazyCatLover 12-22-2014 02:40 AM
Midnight Commander Help
Hi,

I need to know how to check the current colour for mc and how to change it.
I google it and they talk about changeing some initial file /.mc/ini which i have no idea (no one ever gives full filename.)and i cant find it at all. Wasted an hour of my life. I just need the simplest way to change it, not another 10+ steps to change a stupid colour.


gengisdave 12-22-2014 03:22 AM
in some distros (mine, e.g.) it is located in ~/.local/mc/ini

sycamorex 12-22-2014 03:24 AM
This is the full filename. Mind you on my distro it's in ~/.config/mc/ini
Find / Create this file and add the following (obviously change the colour values):

The syntax is: variable=foreground_colour,background_colour
Code:

[Colors]
base_color=lightgray,green:normal=green,default:selected=white,gray:marked=yellow,default:markselect=yellow,gray:directory=blue,default:executable=brightgreen,default:link=cyan,default:device=brightmagenta,default:special=lightgray,default:errors=red,default:reverse=green,default:gauge=green,default:input=white,gray:dnormal=green,gray:dfocus=brightgreen,gray:dhotnormal=cyan,gray:dhotfocus=brightcyan,gray:menu=green,default:menuhot=cyan,default:menusel=green,gray:menuhotsel=cyan,default:helpnormal=cyan,default:editnormal=green,default:editbold=blue,default:editmarked=gray,blue:stalelink=red,default

Also, have a look at this:
http://blog.mybox.ro/2010/05/10/skin...ght-commander/

[Aug 10, 2019] Plug-and-Pray Editing Midnight Commander's color scheme

Aug 10, 2019 | plug-and-pray.blogspot.com

Editing Midnight Commander's color scheme In a previous post I was sort of laying out a "formula" on how to transform your Midnight Commander default color scheme into a trasnparent skin, without talking too much about how you can change the other colors.

To my great shame, I didn't pay too much attention to this blog or to the comments asking for further advice. I found Mateus' comment rather late (just now!) and decided to dig further, in order to find out how exactly to deal with more refined color changes, while still keeping the transparent background (in both in Midnight Commander and its editor).

So the first thing to know is which are the colors that Midnight Commander supports; the available colors are:

black
gray
lightgray
white
red
brightred
green
brightgreen
blue
brightblue
magenta
brightmagenta
cyan
brightcyan
brown
yellow
default

The " default " color is the one giving out the nice transparency.

Now, there are certain "components" in Midnight Commander's display that can have their colors altered. Here they are:

base_color, normal, selected, marked, markselect, errors, menu, reverse, dnormal, dfocus, dhotnormal, dhotfocus, viewunderline, menuhot, menusel, menuhotsel, helpnormal, helpitalic, helpbold, helplink, helpslink, gauge, input, directory, executable, link, stalelink, device, core, special, editnormal, editbold, editmarked, errdhotnormal, errdhotfocus

Each and every one of these "components" can have its own colors set accordingly to the user's wish. Each component is assigned a color pair and must be followed by a colon (':') in order to separate it from the color pair of the next component. Here's how this basic syntax must look like:

component=foreground_color,background_color:

When you start modifying the color scheme in your Midnight Commander configuration file (located at ~/.mc/ini ), you just have to add a section called " [Colors] " and proceed with enumerating the color pairs. So you'd have something like this:

# the rest of your ~/.mc/ini file

[Colors]
component1=foreground_color1,background_color1:...:componentN= foreground_colorN,background_colorN

For increased readability, I will "truncate" that long line, adding a backslash ('\') to indicate that in fact what follows on the next line should be adjacent to the text on the previous line. This being said, the [Colors] section could look like this:

# the rest of your ~/.mc/ini file

[Colors]
component1=foreground_color1,background_color1:\
component2=foreground_color2,background_color2:\
...
componentN=foreground_colorN,background_colorN

Now that you've gotten the hang of this, let's see how the [Colors] section looks like in the default Midnight Commander color scheme (you know, the "ugly" one, with blue and dull cyan):

IMPORTANT NOTE: For visual impact's sake and due to Blogspot breaking long lines, I wrote each color pair on a single row, followed by a backslash ('\'). Please note that this does NOT work in the ~/.mc/ini file, so the final [Colors] section in your Midnight Commander configuration file MUST be a SINGLE line with no spaces and with each color pair separated from the next one by a colon (':').

# the rest of your ~/.mc/ini file

[Colors]
base_color=lightgray,blue:\
normal=lightgray,blue:\
selected=black,cyan:\
marked=yellow,blue:\
markselect=yellow,cyan:\
errors=white,red:\
menu=white,cyan:\
reverse=black,lightgray:\
dnormal=black,lightgray:\
dfocus=black,cyan:\
dhotnormal=blue,lightgray:\
dhotfocus=blue,cyan:\
viewunderline=brightred,blue:\
menuhot=yellow,cyan:\
menusel=white,black:\
menuhotsel=yellow,black:\
helpnormal=black,lightgray:\
helpitalic=red,lightgray:\
helpbold=blue,lightgray:\
helplink=black,cyan:\
helpslink=yellow,blue:\
gauge=white,black:\
input=black,cyan:\
directory=white,blue:\
executable=brightgreen,blue:\
link=lightgray,blue:\
stalelink=brightred,blue:\
device=brightmagenta,blue:\
core=red,blue:\
special=black,blue:\
editnormal=lightgray,blue:\
editbold=yellow,blue:\
editmarked=black,cyan:\
errdhotnormal=yellow,red:\
errdhotfocus=yellow,lightgray

Now let's see. What you want to change first of all is most of the background of these "components", such that the display will be one with a neat looking transparent background. So first of all you might want to make a few changes to these color pairs by replacing the background color "blue" with "default". After doing these changes, your [Colors] section will look a bit like this:

# the rest of your ~/.mc/ini file

[Colors]
base_color=lightgray,default:\
normal=lightgray,default:\
selected=black,cyan:\
marked=yellow,default:\
markselect=yellow,cyan:\
errors=white,red:\
menu=white,cyan:\
reverse=black,lightgray:\
dnormal=black,lightgray:\
dfocus=black,cyan:\
dhotnormal=blue,lightgray:\
dhotfocus=blue,cyan:\
viewunderline=brightred,default:\
menuhot=yellow,cyan:\
menusel=white,black:\
menuhotsel=yellow,black:\
helpnormal=black,lightgray:\
helpitalic=red,lightgray:\
helpbold=blue,lightgray:\
helplink=black,cyan:\
helpslink=yellow,default:\
gauge=white,black:\
input=black,cyan:\
directory=white,default:\
executable=brightgreen,default:\
link=lightgray,default:\
stalelink=brightred,default:\
device=brightmagenta,default:\
core=red,default:\
special=black,default:\
editnormal=lightgray,default:\
editbold=yellow,default:\
editmarked=black,cyan:\
errdhotnormal=yellow,red:\
errdhotfocus=yellow,lightgray

Now you've got the basic "Midnight Commander transparent scheme" that was the result of this post .

Proceeding to Mateus' question, regarding how to change the rest of the colors now, it's about the same as before. What he didn't like there (and as a matter of fact I don't quite like it, either) is the dull cyan that's still seen in the following places:

  1. the bottom line (the one displaying the F1...F10 function keys);
  2. the line that signifies the current selection, the "prompt" which shows you on which file/directory you're "on" at a given moment;
  3. the uppermost line (the "menu" line);
  4. the menus themselves, once you open them.
To "fix" issues 1, 2, and 3 it is sufficient to alter the value of the " selected " parameter. Notice how it is initially

selected=black,cyan:\

My personal choice is to replace the background cyan, which I don't really like, with green. To do this, I'll change this color pair to

selected=black,green:\

You can, of course, change the foreground color as well. For me, it's alright to keep the foreground (the text) "black". You can change it to whatever suits your taste.

To "fix" issue number 4 in the list above, you need to change the " menu " parameter. To get it transparent, just change the "cyan" background to "default". Make other adjustments as you see fit. In other words, change

menu=white,cyan:\

into, for instance,

menu=ligthgray,default:\

However, there are a few "leftovers" from the default color scheme.

One of them is the parameter regarding the hotkeys in the menus (the "underlined" character on most of the menu options, showing you what key you can press in order to access that option faster than by moving to it with the arrow keys). This color pair is called " menuhot ". I changed it from

menuhot=yellow,cyan:\

into

menuhot=yellow,default:\

Another thing which might bother you is the color of the line in the panel you're in when you've "selected all" files (when you've pressed the "*" key). This parameter is called " markselect ". I changed it from

markselect=yellow,cyan:\

into

markselect=white,green:\

The color pair of the selected buttons in dialogs is called " dfocus ". I changed mine from

dfocus=black,cyan:\

into

dfocus=black,green:\

In the "focused" buttons or options, the underlined character is called " dhotfocus ". I changed mine from

dhotfocus=blue,cyan:\

into

dhotfocus=brightgreen,green:\

since the background color was already green, after I modified the " dfocus " color pair.

The other buttons or options in the dialogs which have hotkeys assigned to them, but which are not "focused" (the buttons/options that you're not located on at a given moment) are still displayed in blue on a light gray background. This color pair is referred to as " dhotnormal ". Since the blue looks a bit odd there, I changed

dhotnormal=blue,lightgray:\

into

dhotnormal=brightgreen,default:\

Well, this is nice, in window titles and on normal (unfocused) hotkeys I get the transparent background. The problem now is that the rest of the dialog window is still light gray. To change this (to make the window transparent as well), you only need to alter the " dnormal " color pair, such as changing it from

dnormal=black,lightgray:\

into

dnormal=white,default:\

You may notice that the input fields stay cyan, as well; you find these fields in quite a lot of dialog boxes. To alter this, I changed

input=black,cyan:\

into

input=black,green:\

One thing which I consider useful is to have symbolic links displayed in bright cyan (as in the colored listings in the terminal). So I just changed

link=lightgray,default:\

into

link=brightcyan,default:\

Now, regarding the rest of the color pairs, I don't really know what they do. However, if at some point after using Midnight Commander more with this new, neat, transparent/green color scheme you'll notice unwanted leftovers, you can try out other changes in the color pairs values, one at a time, until you determine the troublesome one.

After operating the changes above, my [Colors] section in ~/.mc/ini now looks like this:

[Colors]
base_color=lightgray,default:\
normal=lightgray,default:\
selected=black,green:\
marked=yellow,default:\
markselect=white,green:\
errors=white,red:\
menu=lightgray,default:\
reverse=black,lightgray:\
dnormal=white,default:\
dfocus=black,green:\
dhotnormal=brightgreen,default:\
dhotfocus=brightgreen,green:\
viewunderline=brightred,default:\
menuhot=yellow,default:\
menusel=white,black:\
menuhotsel=yellow,black:\
helpnormal=black,lightgray:\
helpitalic=red,lightgray:\
helpbold=blue,lightgray:\
helplink=black,cyan:\
helpslink=yellow,default:\
gauge=white,black:\
input=black,green:\
directory=white,default:\
executable=brightgreen,default:\
link=brightcyan,default:\
stalelink=brightred,default:\
device=brightmagenta,default:\
core=red,default:\
special=black,default:\
editnormal=lightgray,default:\
editbold=yellow,default:\
editmarked=black,cyan:\
errdhotnormal=yellow,red:\
errdhotfocus=yellow,lightgray

I need to direct you to the " IMPORTANT NOTE " above. The final [Colors] section above is written like this - one pair on each row, followed by a backslash - for clarity's sake. The actual final [Colors] section in your ~/.mc/ini file will have to be a one-liner, with no blanks and no backslashes. So it will probably look similar to this:

base_color=lightgray,default:normal=lightgray,default:selected=black,green:marked=yellow,default:markselect=white,green:errors=white,red:menu=lightgray,default:reverse=black,lightgray:dnormal=white,default:dfocus=black,green:dhotnormal=brightgreen,default:dhotfocus=brightgreen,green:viewunderline=brightred,default:menuhot=yellow,default:menusel=white,black:menuhotsel=yellow,black:helpnormal=black,lightgray:helpitalic=red,lightgray:helpbold=blue,lightgray:helplink=black,cyan:helpslink=yellow,default:gauge=white,black:input=black,green:directory=white,default:executable=brightgreen,default:link=brightcyan,default:stalelink=brightred,default:device=brightmagenta,default:core=red,default:special=black,default:editnormal=lightgray,default:editbold=yellow,default:editmarked=black,cyan:errdhotnormal=yellow,red:errdhotfocus=yellow,lightgray

Now, the next time you start mc , the new color scheme will take effect.

As a bonus, here's a picture of how my Midnight Commander looks like, with this new "skin" on:

Posted by Alexandra at Labels: color scheme , mc , transparency

[Aug 10, 2019] Midnight Commander color scheme ~ centosvn

Aug 10, 2019 | centos-vn.blogspot.com

Midnight Commander (or "mc") can have transparent panels instead of the ugly, dull default blue. So can "mcedit", its text editor.

Here's how to do it. Edit the file ~/.mc/ini and add at the end the following:

[Colors]
base_color=normal=,default:selected=,:marked=,default:\
markselect=,:menu=,:menuhot=,:menusel=,:\
menuhotsel=,:dnormal=,:dfocus=,:dhotnormal=,:dhotfocus=,:\
input=,:reverse=,:executable=,default:directory=,default:\
link=,default:device=,default:special=,:core=,:helpnormal=,:\
helplink=,:helpslink=,:editnormal=,default:

Note #1: In the above 'code' block, there is only one line below [Colors] . I truncated the line with the backslash because of blogspot rendering issues. You just write all that on one single line, without the "\" (backslash-es).

Note #2: At the end of this line, the " editnormal,=default: " option means that mcedit will have transparent background in your console, as well.

To my great shame, I didn't pay too much attention to this blog or to the comments asking for further advice. I found Mateus' comment rather late (just now!) and decided to dig further, in order to find out how exactly to deal with more refined color changes, while still keeping the transparent background (in both in Midnight Commander and its editor).

So the first thing to know is which are the colors that Midnight Commander supports; the available colors are:

black
gray
lightgray
white
red
brightred
green
brightgreen
blue
brightblue
magenta
brightmagenta
cyan
brightcyan
brown
yellow
default

The " default " color is the one giving out the nice transparency.

Now, there are certain "components" in Midnight Commander's display that can have their colors altered. Here they are:

base_color, normal, selected, marked, markselect, errors, menu, reverse, dnormal, dfocus, dhotnormal, dhotfocus, viewunderline, menuhot, menusel, menuhotsel, helpnormal, helpitalic, helpbold, helplink, helpslink, gauge, input, directory, executable, link, stalelink, device, core, special, editnormal, editbold, editmarked, errdhotnormal, errdhotfocus

Each and every one of these "components" can have its own colors set accordingly to the user's wish. Each component is assigned a color pair and must be followed by a colon (':') in order to separate it from the color pair of the next component. Here's how this basic syntax must look like:

component=foreground_color,background_color:

When you start modifying the color scheme in your Midnight Commander configuration file (located at ~/.mc/ini ), you just have to add a section called " [Colors] " and proceed with enumerating the color pairs. So you'd have something like this:

# the rest of your ~/.mc/ini file

[Colors]
component1=foreground_color1,background_color1:...:componentN= foreground_colorN,background_colorN

For increased readability, I will "truncate" that long line, adding a backslash ('\') to indicate that in fact what follows on the next line should be adjacent to the text on the previous line. This being said, the [Colors] section could look like this:

# the rest of your ~/.mc/ini file

[Colors]
component1=foreground_color1,background_color1:\
component2=foreground_color2,background_color2:\
...
componentN=foreground_colorN,background_colorN

Now that you've gotten the hang of this, let's see how the [Colors] section looks like in the default Midnight Commander color scheme (you know, the "ugly" one, with blue and dull cyan):

IMPORTANT NOTE: For visual impact's sake and due to Blogspot breaking long lines, I wrote each color pair on a single row, followed by a backslash ('\'). Please note that this does NOT work in the ~/.mc/ini file, so the final [Colors] section in your Midnight Commander configuration file MUST be a SINGLE line with no spaces and with each color pair separated from the next one by a colon (':').

# the rest of your ~/.mc/ini file

[Colors]
base_color=lightgray,blue:\
normal=lightgray,blue:\
selected=black,cyan:\
marked=yellow,blue:\
markselect=yellow,cyan:\
errors=white,red:\
menu=white,cyan:\
reverse=black,lightgray:\
dnormal=black,lightgray:\
dfocus=black,cyan:\
dhotnormal=blue,lightgray:\
dhotfocus=blue,cyan:\
viewunderline=brightred,blue:\
menuhot=yellow,cyan:\
menusel=white,black:\
menuhotsel=yellow,black:\
helpnormal=black,lightgray:\
helpitalic=red,lightgray:\
helpbold=blue,lightgray:\
helplink=black,cyan:\
helpslink=yellow,blue:\
gauge=white,black:\
input=black,cyan:\
directory=white,blue:\
executable=brightgreen,blue:\
link=lightgray,blue:\
stalelink=brightred,blue:\
device=brightmagenta,blue:\
core=red,blue:\
special=black,blue:\
editnormal=lightgray,blue:\
editbold=yellow,blue:\
editmarked=black,cyan:\
errdhotnormal=yellow,red:\
errdhotfocus=yellow,lightgray

Now let's see. What you want to change first of all is most of the background of these "components", such that the display will be one with a neat looking transparent background. So first of all you might want to make a few changes to these color pairs by replacing the background color "blue" with "default". After doing these changes, your [Colors] section will look a bit like this:

# the rest of your ~/.mc/ini file

[Colors]
base_color=lightgray,default:\
normal=lightgray,default:\
selected=black,cyan:\
marked=yellow,default:\
markselect=yellow,cyan:\
errors=white,red:\
menu=white,cyan:\
reverse=black,lightgray:\
dnormal=black,lightgray:\
dfocus=black,cyan:\
dhotnormal=blue,lightgray:\
dhotfocus=blue,cyan:\
viewunderline=brightred,default:\
menuhot=yellow,cyan:\
menusel=white,black:\
menuhotsel=yellow,black:\
helpnormal=black,lightgray:\
helpitalic=red,lightgray:\
helpbold=blue,lightgray:\
helplink=black,cyan:\
helpslink=yellow,default:\
gauge=white,black:\
input=black,cyan:\
directory=white,default:\
executable=brightgreen,default:\
link=lightgray,default:\
stalelink=brightred,default:\
device=brightmagenta,default:\
core=red,default:\
special=black,default:\
editnormal=lightgray,default:\
editbold=yellow,default:\
editmarked=black,cyan:\
errdhotnormal=yellow,red:\
errdhotfocus=yellow,lightgray

Now you've got the basic "Midnight Commander transparent scheme" that was the result of this post .

Proceeding to Mateus' question, regarding how to change the rest of the colors now, it's about the same as before. What he didn't like there (and as a matter of fact I don't quite like it, either) is the dull cyan that's still seen in the following places:

  1. the bottom line (the one displaying the F1...F10 function keys);
  2. the line that signifies the current selection, the "prompt" which shows you on which file/directory you're "on" at a given moment;
  3. the uppermost line (the "menu" line);
  4. the menus themselves, once you open them.
To "fix" issues 1, 2, and 3 it is sufficient to alter the value of the " selected " parameter. Notice how it is initially

selected=black,cyan:\

My personal choice is to replace the background cyan, which I don't really like, with green. To do this, I'll change this color pair to

selected=black,green:\

You can, of course, change the foreground color as well. For me, it's alright to keep the foreground (the text) "black". You can change it to whatever suits your taste.

To "fix" issue number 4 in the list above, you need to change the " menu " parameter. To get it transparent, just change the "cyan" background to "default". Make other adjustments as you see fit. In other words, change

menu=white,cyan:\

into, for instance,

menu=ligthgray,default:\

However, there are a few "leftovers" from the default color scheme.

One of them is the parameter regarding the hotkeys in the menus (the "underlined" character on most of the menu options, showing you what key you can press in order to access that option faster than by moving to it with the arrow keys). This color pair is called " menuhot ". I changed it from

menuhot=yellow,cyan:\

into

menuhot=yellow,default:\

Another thing which might bother you is the color of the line in the panel you're in when you've "selected all" files (when you've pressed the "*" key). This parameter is called " markselect ". I changed it from

markselect=yellow,cyan:\

into

markselect=white,green:\

The color pair of the selected buttons in dialogs is called " dfocus ". I changed mine from

dfocus=black,cyan:\

into

dfocus=black,green:\

In the "focused" buttons or options, the underlined character is called " dhotfocus ". I changed mine from

dhotfocus=blue,cyan:\

into

dhotfocus=brightgreen,green:\

since the background color was already green, after I modified the " dfocus " color pair.

The other buttons or options in the dialogs which have hotkeys assigned to them, but which are not "focused" (the buttons/options that you're not located on at a given moment) are still displayed in blue on a light gray background. This color pair is referred to as " dhotnormal ". Since the blue looks a bit odd there, I changed

dhotnormal=blue,lightgray:\

into

dhotnormal=brightgreen,default:\

Well, this is nice, in window titles and on normal (unfocused) hotkeys I get the transparent background. The problem now is that the rest of the dialog window is still light gray. To change this (to make the window transparent as well), you only need to alter the " dnormal " color pair, such as changing it from

dnormal=black,lightgray:\

into

dnormal=white,default:\

You may notice that the input fields stay cyan, as well; you find these fields in quite a lot of dialog boxes. To alter this, I changed

input=black,cyan:\

into

input=black,green:\

One thing which I consider useful is to have symbolic links displayed in bright cyan (as in the colored listings in the terminal). So I just changed

link=lightgray,default:\

into

link=brightcyan,default:\

Now, regarding the rest of the color pairs, I don't really know what they do. However, if at some point after using Midnight Commander more with this new, neat, transparent/green color scheme you'll notice unwanted leftovers, you can try out other changes in the color pairs values, one at a time, until you determine the troublesome one.

After operating the changes above, my [Colors] section in ~/.mc/ini now looks like this:

[Colors]
base_color=lightgray,default:\
normal=lightgray,default:\
selected=black,green:\
marked=yellow,default:\
markselect=white,green:\
errors=white,red:\
menu=lightgray,default:\
reverse=black,lightgray:\
dnormal=white,default:\
dfocus=black,green:\
dhotnormal=brightgreen,default:\
dhotfocus=brightgreen,green:\
viewunderline=brightred,default:\
menuhot=yellow,default:\
menusel=white,black:\
menuhotsel=yellow,black:\
helpnormal=black,lightgray:\
helpitalic=red,lightgray:\
helpbold=blue,lightgray:\
helplink=black,cyan:\
helpslink=yellow,default:\
gauge=white,black:\
input=black,green:\
directory=white,default:\
executable=brightgreen,default:\
link=brightcyan,default:\
stalelink=brightred,default:\
device=brightmagenta,default:\
core=red,default:\
special=black,default:\
editnormal=lightgray,default:\
editbold=yellow,default:\
editmarked=black,cyan:\
errdhotnormal=yellow,red:\
errdhotfocus=yellow,lightgray

I need to direct you to the " IMPORTANT NOTE " above. The final [Colors] section above is written like this - one pair on each row, followed by a backslash - for clarity's sake. The actual final [Colors] section in your ~/.mc/ini file will have to be a one-liner, with no blanks and no backslashes. So it will probably look similar to this:

base_color=lightgray,default:normal=lightgray,default:selected=black,green:marked=yellow,default:markselect=white,green:errors=white,red:menu=lightgray,default:reverse=black,lightgray:dnormal=white,default:dfocus=black,green:dhotnormal=brightgreen,default:dhotfocus=brightgreen,green:viewunderline=brightred,default:menuhot=yellow,default:menusel=white,black:menuhotsel=yellow,black:helpnormal=black,lightgray:helpitalic=red,lightgray:helpbold=blue,lightgray:helplink=black,cyan:helpslink=yellow,default:gauge=white,black:input=black,green:directory=white,default:executable=brightgreen,default:link=brightcyan,default:stalelink=brightred,default:device=brightmagenta,default:core=red,default:special=black,default:editnormal=lightgray,default:editbold=yellow,default:editmarked=black,cyan:errdhotnormal=yellow,red:errdhotfocus=yellow,lightgray

Now, the next time you start mc , the new color scheme will take effect.

As a bonus, here's a picture of how my Midnight Commander looks like, with this new "skin" on:

Email This BlogThis! Share to Twitter Share to Facebook

[Aug 10, 2019] Midnight Commander colors and themes

Aug 10, 2019 | ajnasz.hu

Koszti Lajos Midnight Commander is the most pupular file manager on unix like systems. It's fast and it has all features what you need. But it's only blue and we know, that everyone loves the eyecandy, everyone likes customizing his/her own desktop. But is there any way to custimize the mc ?
Yes, and I try to show you, how can you create your theme .

You can change the Midnight Commander colors if you edit the ~/.mc/ini file, where you have to add a new section, named [Colors] . You should define the new colors in this section, for example:

[Colors] base_color=lightgray,green:normal=green,default:selected=white,gray ...

As you see, it has a simple syntax:

=,:= ...

The colors are optional, so you can use this:

[Colors] base_color=lightgray,green:normal=green:selected=,gray ...

It's not the exactly the same as the first version!

Fine, you can change some colors of the filemanager, but which are the keywords? These are:

  • Base colors: normal, selected, marked, markselect, errors, input, reverse, gauge
  • Menu colors: menu, menusel, menuhot, menuhotsel
  • Dialog colors: dnormal, dfocus, dhotnormal, dhotfocus
  • Help colors: helpnormal, helpitalic, helpbold, helplink, helpslink
  • Viewer color: viewunderline
  • Special highlighting colors: executable, directory, link, stalelink, device, special, core
  • Editor colors: editnormal, editbold, editmarked

And which are the colors? I don't know all, but here are some of them:
white, gray, blue, green, yellow, magenta, cyan, red, brown, birghtgreen, brightblue, brightmagenta, brightcyan, brightred, default

Here is the config, what I use:

[Colors] base_color=lightgray,green:normal=green,default:selected=white,gray:marked=yellow,default:markselect=yellow,gray:directory=blue,default:executable=brightgreen,default:link=cyan,default:device=brightmagenta,default:special=lightgray,default:errors=red,default:reverse=green,default:gauge=green,default:input=white,gray:dnormal=green,gray:dfocus=brightgreen,gray:dhotnormal=cyan,gray:dhotfocus=brightcyan,gray:menu=green,default:menuhot=cyan,default:menusel=green,gray:menuhotsel=cyan,default:helpnormal=cyan,default:editnormal=green,default:editbold=blue,default:editmarked=gray,blue:stalelink=red,default

Screenshot about my redesigned Midnight Commander

On the screenshot you can see, that the directory color is blue, the files are green, the executable files are birghtgreen and the selected line is white on a gray background.

And another one, what I use recently:

[Colors] base_color=lightgray,blue:normal=blue,default:selected=white,brightblue:marked=yellow,default:markselect=yellow,gray:directory=brightblue,default:executable=brightgreen,default:link=cyan,default:device=brightmagenta,default:special=lightgray,default:errors=red,default:reverse=green,default:gauge=green,default:input=white,gray:dnormal=green,gray:dfocus=brightgreen,gray:dhotnormal=cyan,gray:dhotfocus=brightcyan,gray:menu=green,default:menuhot=cyan,default:menusel=green,gray:menuhotsel=cyan,default:helpnormal=cyan,default:editnormal=green,default:editbold=blue,default:editmarked=gray,blue:stalelink=red,default

Screenshot about my redesigned Midnight Commander

And here is a small shell script, which will help for you to test your new theme:

#!/bin/sh mc --colors normal=green,default:selected=brightmagenta,gray:marked=yellow,default:markselect=yellow,gray:directory=blue,default:executable=brightgreen,default:link=cyan,default:device=brightmagenta,default:special=lightgray,default:errors=red,default:reverse=green,default:gauge=green,default:input=white,gray:dnormal=green,gray:dfocus=brightgreen,gray:dhotnormal=cyan,gray:dhotfocus=brightcyan,gray:menu=green,default:menuhot=cyan,default:menusel=green,gray:menuhotsel=cyan,default:helpnormal=cyan,default:editnormal=green,default:editbold=blue,default:editmarked=gray,blue:stalelink=red,default

Download the shell script to make your own mc theme

Save it as mccolortest.sh, make it executable with the chmod +x mccolortest.sh command, and run it with the ./mccolortest.sh command. If you want to change a color, just edit this file. When you done, copy the colors and paste it below the [Colors] section in the ~/.mc/ini . If it doesn't exists, make it yourself.

For more information of the mc redesigning check its manual page .

Mauricio2 hónapja ,

Awesome!
Thank you for your clear explanation.

Anonymous • 6 éve ,

Thank you for theme. I tried your last theme and it is exactly what I was searching for.

Anonymous • 6 éve ,

Also, in 4.8.3 here, I copied the first example scheme line and my colors are different. I can't even set the background of the select bar to gray (or "grey"): it gets replaced with black. Also, the panel headings remain blue here, unlike the (first) screenshot, and I can see no corresponding tag in the line anyway.

Good intro, regardless. Someone should post a pointer to a more up-to-date one, though, as Google seems to find this old thread within the top few hits. Király! ;)

--lunakid

Ajnasz Anonymous6 éve ,

The colors are depends on the color settings of your terminal. I don't have those settings anymore which was when I posted this article, but here is my current. If I'm right, it's similar to that. Put it into your .Xdefaults

*background: #000000
*foreground: #EEEEEC
! Default
! 0: black
*color0: #1C1C1C
*color8: #333333
! 1: red
*color1: #C14242
*color9: #EF2929
! 2: green
*color2: #6AA037
*color10: #9DCF70
! 3: yellow
*color3: #CFAB2F
*color11: #FCDA4F
! 4: blue
*color4: #2D578A
*color12: #729FCF
! 5: magenta
*color5: #A85EB4
*color13: #AD7FA8
! 6: cyan
*color6: #2F8D8F
*color14: #34E2E2
! 7: white
*color7: #D3D7CF
*color15: #EEEEEC
Anonymous • 7 éve ,

Now ~/.mc dir is ignored. Now is ~/.config/mc ;)

Anonymous • 10 éve ,

Midnight Commander supports skins starting from 4.7.0-pre3 version. You can download a skin with black as a main color from here:
http://zool.in.ua/software/bluemoon/

Anonymous • 10 éve ,

I am using MC on my router ASUS WL-500GP and I am developing php scripts on it. but as I see MC in openwrt (kmaikaze 8.09) does not use syntax-highlighting and it is very unconfortable.
Do you know how could I turn it on? I have already downloaded php.syntax file and put it into /usr/share/syntax dir but it does not seem to work. is it possible that some support is not compiled into my version or the syntax file must be compiled to another format?
Br Zé.

Anonymous Anonymous10 éve ,

I found it. in ~/.mc/cedit/Syntax must be this:
file ..\*\\.(php|PHP)$ PHP\sFile
include php.syntax

and in the same dir php.syntax file must be placed. (copied out from a source distrib)

Anonymous • 10 éve ,

hei ajnasz, your color theme so very nice, keep my eye on my pc longer than usual. Well, i don't have much time to do more explore with this tricks. I think your taste so cool. If you have any kind of theme, i should be try it. :-)

Regards,

Dedi

Anonymous • 10 éve ,

Any chance to change the color of the files by extension?

Anonymous Anonymous10 éve ,

Midnight Commander supports this starting from 4.7.0-pre3 version.

Ajnasz Anonymous10 éve ,

I didn't find anything about it. By the way, since the extension doesn't determinate the file type in UNIX like systems, it wouldn't make any sense to do it.

Anonymous Ajnasz9 éve ,

Don't be silly. Mp3 is just music, txt is text, doc is document. The only thing, which is not exactly determinable is the executables, but whatever, it has +x flag.

Anonymous • 11 éve ,

Also, you should know that most modern terminal applications allow you to redefine the exact shade of those 16 colors.

Some of them (such as the Gnome or KDE terminals) may have a place under their preferences where you can redefine the colors.

Older terminals, such as aterm, use ~/.Xdefaults for this. You can edit that file and add lines like this: "aterm*color1: OrangeRed" (without the quotes). What I've done with that is tell aterm that the "color1" (which was red) should now be "OrangeRed". See /usr/share/X11/rgb.txt for valid color names. You can use *color0 through *color15. So when you'll say "red" in MC's ini file, and if you use aterm, it will get replaced by color1 in ~/.Xdefaults and changed to OrangeRed. (Sorry, I don't remember the mappings between the names used by MC and 0-15 in Xdefaults by heart.)

Anonymous • 12 éve ,

On the same subject:
http://www.zagura.ro/index....

[Jul 30, 2019] The difference between tar and tar.gz archives

With tar.gz to extract a file archiver first creates an intermediary tarball x.tar file from x.tar.gz by uncompressing the whole archive then unpack requested files from this intermediary tarball. In tar.gz archive is large unpacking can take several hours or even days.
Jul 30, 2019 | askubuntu.com
  • @ChristopheDeTroyer Tarballs are compressed in such a way that you have to decompress them in full, then take out the file you want. I think that .zip folders are different, so if you want to be able to take out individual files fast, try them. – GKFX Jun 3 '16 at 13:04

[Jul 28, 2019] command line - How do I extract a specific file from a tar archive - Ask Ubuntu

Jul 28, 2019 | askubuntu.com

CMCDragonkai, Jun 3, 2016 at 13:04

1. Using the Command-line tar

Yes, just give the full stored path of the file after the tarball name.

Example: suppose you want file etc/apt/sources.list from etc.tar :

tar -xf etc.tar etc/apt/sources.list

Will extract sources.list and create directories etc/apt under the current directory.

  • You can use the -t listing option instead of -x , maybe along with grep , to find the path of the file you want
  • You can also extract a single directory
  • tar has other options like --wildcards , etc. for more advanced partial extraction scenarios; see man tar
2. Extract it with the Archive Manager

Open the tar in Archive Manager from Nautilus, go down into the folder hierarchy to find the file you need, and extract it.

  • On a server or command-line system, use a text-based file manager such as Midnight Commander ( mc ) to accomplish the same.
3. Using Nautilus/Archive-Mounter

Right-click the tar in Nautilus, and select Open with ArchiveMounter.

The tar will now appear similar to a removable drive on the left, and you can explore/navigate it like a normal drive and drag/copy/paste any file(s) you need to any destination.

[Jul 28, 2019] iso - midnight commander rules for accessing archives through VFS - Unix Linux Stack Exchange

Jul 28, 2019 | unix.stackexchange.com

,

Midnight Commander uses virtual filesystem ( VFS ) for displying files, such as contents of a .tar.gz archive, or of .iso image. This is configured in mc.ext with rules such as this one ( Open is Enter , View is F3 ):
regex/\.([iI][sS][oO])$
    Open=%cd %p/iso9660://
    View=%view{ascii} isoinfo -d -i %f

When I press Enter on an .iso file, mc will open the .iso and I can browse individual files. This is very useful.

Now my question: I have also files which are disk images, i.e. created with pv /dev/sda1 > sda1.img

I would like mc to "browse" the files inside these images in the same fashion as .iso .

Is this possible ? How would such rule look like ?

[Jul 28, 2019] How to Use Midnight Commander, a Visual File Manager

Jul 28, 2019 | www.linode.com
  1. Another tool that can save you time is Midnight Commander's user menu. Go back to /tmp/test where you created nine files. Press F2 and bring up the user menu. Select Compress the current subdirectory (tar.gz) . After you choose the name for the archive, this will be created in /tmp (one level up from the directory being compressed). If you highlight the .tar.gz file and press ENTER you'll notice it will open like a regular directory. This allows you to browse archives and extract files by simply copying them ( F5 ) to the opposite panel's working directory.

    Midnight Commander User Menu

  2. To find out the size of a directory (actually, the size of all the files it contains), highlight the directory and then press CTRL+SPACE .
  3. To search, go up in your directory tree until you reach the top level, / , called root directory. Now press F9 , then c , followed by f . After the Find File dialog opens, type *.gz . This will find any accessible gzip archive on the system. In the results dialog, press l (L) for Panelize . All the results will be fed to one of your panels so you can easily browse, copy, view and so on. If you enter a directory from that list, you lose the list of found files, but you can easily return to it with F9 , l (L) then z (to select Panelize from the Left menu).

    Midnight Commander - Find File Dialog

  4. Managing files is not always done locally. Midnight Commander also supports accessing remote filesystems through SSH's Secure File Transfer Protocol, SFTP . This way you can easily transfer files between servers.

    Press F9 , followed by l (L), then select the SFTP link menu entry. In the dialog box titled SFTP to machine enter sftp://example@203.0.113.0 . Replace example with the username you have created on the remote machine and 203.0.113.1 with the IP address of your server. This will work only if the server at the other end accepts password logins. If you're logging in with SSH keys, then you'll first need to create and/or edit ~/.ssh/config . It could look something like this:

    ~/.ssh/config
    1
    2
    3
    4
    5
    
    Host sftp_server
        HostName 203.0.113.1
        Port 22
        User your_user
        IdentityFile ~/.ssh/id_rsa
    

    You can choose whatever you want as the Host value, it's only an identifier. IdentityFile is the path to your private SSH key.

    After the config file is setup, access your SFTP server by typing the identifier value you set after Host in the SFTP to machine dialog. In this example, enter sftp_server .

[Jul 28, 2019] Bartosz Kosarzycki's blog Midnight Commander how to compress a file-directory; Make a tar archive with midnight commander

Jul 28, 2019 | kosiara87.blogspot.com

Midnight Commander how to compress a file/directory; Make a tar archive with midnight commander

To compress a file in Midnight Commader (e.g. to make a tar.gz archive) navigate to the directory you want to pack and press 'F2'. This will bring up the 'User menu'. Choose the option 'Compress the current subdirectory'. This will compress the WHOLE directory you're currently in - not the highlighted directory.

[Jan 01, 2019] Re: customize columns in single panel view

Jun 12, 2017 | mail.gnome.org
On 6/12/17, Karel  wrote:
Hello,
Is it possible to customize the columns in the single panel view ?
For my default (two panel) view, I have customized it using:
 -> Listing Mode
   (*) User defined:
      half type name | size:15 | mtime
however, when I switch to the single panel view, there are different
columns (obviously):
  Permission   Nl   Owner   Group   Size   Modify time   Name
For instance, I need to change the width of "Size" to 15.
No, you can't change the format of the "Long" listing-mode.
(You can make the "User defined" listing-mode display in one panel (by
changing "half" to "full"), but this is not what you want.)
So, you have two options:
(1) Modify the source code (search panel.c for "full perm space" and
tweak it); or:
(2) Use mc^2. It allows you to do this. (It already comes with a
snippet that enlarges the "Size" field a bit so there'd be room for
the commas (or other locale-dependent formatting) it adds. This makes
reading long numbers much easier.)

[Jan 01, 2019] Re- Help- meaning of the panelize command in left-right menus

Feb 17, 2017 | mail.gnome.org
  • From : Cristian Rigamonti
  • To : mc gnome org
  • Subject : Re: Help: meaning of the panelize command in left/right menus
  • Date : Fri, 17 Feb 2017 15:00:16 +0100
On Thu, Feb 16, 2017 at 01:25:22PM +1300, William Kimber wrote:
Briefly,  if you do a search over several directories you can put all those
files into a single panel. Not withstanding that they are from different
directories.
I'm not sure I understand what you mean here; anyway I noticed that if you do a
search using the "Find file" (M-?) command, choose "Panelize" (at the bottom
of the "Find File" popup window), then change to some other directory (thus
exiting from panelized mode), if you now choose Left -> Panelize, you can recall
the panelized view of the last "Find file" results. Is this what you mean?
However this seems to work only with panelized results coming from the
"Find file" command, not with results from the "External panelize" command:
if I change directory, and then choose Left -> Panelize I get an empty panel.
Is this a bug?
Cri

[Jan 01, 2019] Re- Help- meaning of the panelize command in left-right menus

Jan 01, 2019 | mail.gnome.org

Re: Help: meaning of the panelize command in left/right menus

  • From : Cristian Rigamonti
  • To : mc gnome org
  • Subject : Re: Help: meaning of the panelize command in left/right menus
  • Date : Fri, 17 Feb 2017 15:00:16 +0100
On Thu, Feb 16, 2017 at 01:25:22PM +1300, William Kimber wrote:
Briefly,  if you do a search over several directories you can put all those
files into a single panel. Not withstanding that they are from different
directories.
I'm not sure I understand what you mean here; anyway I noticed that if you do a
search using the "Find file" (M-?) command, choose "Panelize" (at the bottom
of the "Find File" popup window), then change to some other directory (thus
exiting from panelized mode), if you now choose Left -> Panelize, you can recall
the panelized view of the last "Find file" results. Is this what you mean?
However this seems to work only with panelized results coming from the
"Find file" command, not with results from the "External panelize" command:
if I change directory, and then choose Left -> Panelize I get an empty panel.
Is this a bug?
Cri

[Jan 01, 2019] Re- customize columns in single panel view

Jan 01, 2019 | mail.gnome.org
On 6/12/17, Karel  wrote:
Hello,
Is it possible to customize the columns in the single panel view ?
For my default (two panel) view, I have customized it using:
 -> Listing Mode
   (*) User defined:
      half type name | size:15 | mtime
however, when I switch to the single panel view, there are different
columns (obviously):
  Permission   Nl   Owner   Group   Size   Modify time   Name
For instance, I need to change the width of "Size" to 15.
No, you can't change the format of the "Long" listing-mode.
(You can make the "User defined" listing-mode display in one panel (by
changing "half" to "full"), but this is not what you want.)
So, you have two options:
(1) Modify the source code (search panel.c for "full perm space" and
tweak it); or:
(2) Use mc^2. It allows you to do this. (It already comes with a
snippet that enlarges the "Size" field a bit so there'd be room for
the commas (or other locale-dependent formatting) it adds. This makes
reading long numbers much easier.)

[Jan 01, 2019] %f macro in mcedit

Jan 01, 2019 | mail.gnome.org
  • From : Sergiy Vovk
  • To : mc-devel gnome org
  • Subject : %f macro in mcedit
  • Date : Tue, 26 Sep 2017 17:19:08 +0300
Hi!
My mc version:
$ mc --version
GNU Midnight Commander 4.8.19
System: Fedora 24
I just want to tell you that %f macro in mcedit is not correct. It
contains the current file name that is selected in the panel but not
the actual file name that is opened in mcedit.
I created the mcedit item to run C++ program:
+= f \.cpp$
r       Run
    clear
    app_path=/tmp/$(uuidgen)
    if g++ -o $app_path "%f"; then
        $app_path
        rm $app_path
    fi
    echo 'Press any key to exit.'
    read -s -n 1
Imagine that I opened the file a.cpp in mcedit.
Then I pressed alt+` and switched to panel.
Then I selected (or even opened in mcedit) the file b.cpp.
Then I pressed alt+` and switched to mcedit with a.cpp.
Then I executed the "Run" item from user menu.
And... The b.cpp will be compiled and run. This is wrong! Why b.cpp???
I executed "Run" from a.cpp!
I propose you to do the new macros for mcedit.
%opened_file
- the file name that is opened in current instance of mcedit.
%opened_file_full_path
- as %opened_file but full path to that file.
I think that %opened_file may be not safe because the current
directory may be changed in mc panel. So it is better to use
%opened_file_full_path.
%opened_file_dir
- full path to directory where %opened_file is.
%save
- save opened file before executing the menu commands. May be useful
in some cases. For example I don't want to press F2 every time before
run changed code.
Thanks for the mc.
Best regards, Sergiy Vovk.

[Jan 01, 2019] Re- Setting left and right panel directories at startup

Jan 01, 2019 | mail.gnome.org

Re: Setting left and right panel directories at startup

  • From : Lynn Bradshaw
  • To : Keith Roberts
  • Cc : mc gnome org, wwp
  • Subject : Re: Setting left and right panel directories at startup
  • Date : Mon, 19 Mar 2018 14:21:15 -0400
Sorry, forgot to reply all.
I said that, personally, I would put ~/Documents in the directory hotlist and get there via C-\.

On Sun, Mar 18, 2018 at 5:38 PM, Keith Roberts < keith karsites net > wrote:

On 18/03/18 20:14, wwp wrote:

Hello Keith,

On Sun, 18 Mar 2018 19:14:33 +0000 Keith Roberts < keith karsites net > wrote:

Hi all,

I found this in /home/keith/.config/mc/panels. ini

[Dirs]
current_is_left=true
other_dir=/home/keith/Document s/

I'd like mc to open /home/keith/Documents/ in the left panel as well whenever I start mc up, so both panels are showing the /home/keith/Documents/ directory.

Is there some way to tell mc how to do this please?

I think you could use: `mc `, for instance:
`mc /home/keith/Documents/ /tmp`, but of course this requires you to know
the second path to open in addition to your ~/Documents. Not really
satisfying?

Regards,

Hi wwp,

Thanks for your suggestion and that seems to work OK - I just start mc with the following command:

mc ~/Documents

and both panes are opened at the ~Documents directories now which is fine.

Kind Regards,

Keith Roberts

[Jan 01, 2019] Mc2 by mooffie

Notable quotes:
"... Future Releases ..."
Jan 01, 2019 | midnight-commander.org

#3745 (Integration mc with mc2(Lua)) – Midnight Commander

Ticket #3745 (closed enhancement: invalid)

Opened 2 years ago

Last modified 2 years ago Integration mc with mc2(Lua)

Reported by: q19l405n5a Owned by:
Priority: major Milestone:
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:
Description I think that it is necessary that code base mc and mc2 correspond each other. mooffie? can you check that patches from andrew_b easy merged with mc2 and if some patch conflict with mc2 code hold this changes by writing about in corresponding ticket. zaytsev can you help automate this( continues integration, travis and so on). Sorry, but some words in Russian:

Ребята, я не пытаюсь давать ЦУ, Вы делаете классную работу. Просто яхотел обратить внимание, что Муфья пытается поддерживать свой код в актуальном состоянии, но видя как у него возникают проблемы на ровном месте боюсь энтузиазм у него может пропасть.
Change History comment:1 Changed 2 years ago by zaytsev-work

  • Status changed from new to closed
  • Resolution set to invalid
​ https://mail.gnome.org/archives/mc-devel/2016-February/msg00021.html

I have asked what plans does mooffie have for mc 2 sometime ago and never got an answer. Note that I totally don't blame him for that. Everyone here is working at their own pace. Sometimes I disappear for weeks or months, because I can't get a spare 5 minutes not even speaking of several hours due to the non-mc related workload. I hope that one day we'll figure out the way towards merging it, and eventually get it done.

In the mean time, he's working together with us by offering extremely important and well-prepared contributions, which are a pleasure to deal with and we are integrating them as fast as we can, so it's not like we are at war and not talking to each other.

Anyways, creating random noise in the ticket tracking system will not help to advance your cause. The only way to influence the process is to invest serious amount of time in the development.
comment:2 Changed 2 years ago by zaytsev

  • Milestone Future Releases deleted

Lua-l - [ANN] mc^2

Selected post Oct 15, 2015; 12:13pm [ANN] mc^2
Mooffie 11 posts mc^2 is a fork of Midnight Commander with Lua support:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/

...but let's skip the verbiage and go directly to the screenshots:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/guide/SCREENSHOTS.md.html

Now, I assume most of you here aren't users of MC.

So I won't bore you with description of how Lua makes MC a better
file-manager. Instead, I'll just list some details that may interest
any developer who works on extending some application.

And, as you'll shortly see, you may find mc^2 useful even if you
aren't a user of MC!

So, some interesting details:

* Programmer Goodies

- You can restart the Lua system from within MC.

- Since MC has a built-in editor, you can edit Lua code right there
and restart Lua. So it's somewhat like a live IDE:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/images/screenshots/game.png

- It comes with programmer utilities: regular expressions; global scope
protected by default; good pretty printer for Lua tables; calculator
where you can type Lua expressions; the editor can "lint" Lua code (and
flag uses of global variables).

- It installs a /usr/bin/mcscript executable letting you use all the
goodies from "outside" MC:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/guide/60-standalone.md.html

* User Interface programming (UI)

- You can program a UI (user interface) very easily. The API is fun
yet powerful. It has some DOM/JavaScript borrowings in it: you can
attach functions to events like on_click, on_change, etc. The API
uses "properties", so your code tends to be short and readable:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/guide/40-user-interface.md.html

- The UI has a "canvas" object letting you draw your own stuff. The
system is so fast you can program arcade games. Pacman, Tetris,
Digger, whatever:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/classes/ui.Canvas.html

Need timers in your game? You've got them:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/modules/timer.html

- This UI API is an ideal replacement for utilities like dialog(1).
You can write complex frontends to command-line tools with ease:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/images/screenshots/frontend-scanimage.png

- Thanks to the aforementioned /usr/bin/mcscript, you can run your
games/frontends from "outside" MC:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/images/screenshots/standalone-game.png

* Misc

- You can compile it against Lua 5.1, 5.2, 5.3, or LuaJIT.

- Extensive documentation.

[Jan 01, 2019] mc - How can I set the default (user defined) listing mode in Midnight Commander- - Unix Linux Stack Exchange

Jan 01, 2019 | unix.stackexchange.com

Ask Question 0

papaiatis ,Jul 14, 2016 at 11:51

I defined my own listing mode and I'd like to make it permanent so that on the next mc start my defined listing mode will be set. I found no configuration file for mc.

,

You have probably Auto save setup turned off in Options->Configuration menu.

You can save the configuration manually by Options->Save setup .

Panels setup is saved to ~/.config/mc/panels.ini .

[Jan 01, 2019] Lua-l - [ANN] mc^2

Jan 01, 2019 | n2.nabble.com

Selected post Oct 15, 2015; 12:13pm [ANN] mc^2

Mooffie 11 posts mc^2 is a fork of Midnight Commander with Lua support:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/

...but let's skip the verbiage and go directly to the screenshots:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/guide/SCREENSHOTS.md.html

Now, I assume most of you here aren't users of MC.

So I won't bore you with description of how Lua makes MC a better
file-manager. Instead, I'll just list some details that may interest
any developer who works on extending some application.

And, as you'll shortly see, you may find mc^2 useful even if you
aren't a user of MC!

So, some interesting details:

* Programmer Goodies

- You can restart the Lua system from within MC.

- Since MC has a built-in editor, you can edit Lua code right there
and restart Lua. So it's somewhat like a live IDE:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/images/screenshots/game.png

- It comes with programmer utilities: regular expressions; global scope
protected by default; good pretty printer for Lua tables; calculator
where you can type Lua expressions; the editor can "lint" Lua code (and
flag uses of global variables).

- It installs a /usr/bin/mcscript executable letting you use all the
goodies from "outside" MC:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/guide/60-standalone.md.html

* User Interface programming (UI)

- You can program a UI (user interface) very easily. The API is fun
yet powerful. It has some DOM/JavaScript borrowings in it: you can
attach functions to events like on_click, on_change, etc. The API
uses "properties", so your code tends to be short and readable:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/guide/40-user-interface.md.html

- The UI has a "canvas" object letting you draw your own stuff. The
system is so fast you can program arcade games. Pacman, Tetris,
Digger, whatever:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/classes/ui.Canvas.html

Need timers in your game? You've got them:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/modules/timer.html

- This UI API is an ideal replacement for utilities like dialog(1).
You can write complex frontends to command-line tools with ease:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/images/screenshots/frontend-scanimage.png

- Thanks to the aforementioned /usr/bin/mcscript, you can run your
games/frontends from "outside" MC:

http://www.typo.co.il/~mooffie/mc-lua/docs/html/images/screenshots/standalone-game.png

* Misc

- You can compile it against Lua 5.1, 5.2, 5.3, or LuaJIT.

- Extensive documentation.

[Jan 01, 2019] Re change default configuration

Jan 01, 2019 | mail.gnome.org
On Fri, 27 Jul 2018 17:01:17 +0300 Sergey Naumov via mc-devel wrote:
I'm curious whether there is a way to change default configuration that is
generated when user invokes mc for the first time?
For example, I want "use_internal_edit" to be true by default instead of
false for any new user.
In vanilla mc the initial value of use_internal_edit is true. Some distros
(Debian and some others) change this to false.
If there is a way to do it, then is it possible to just use lines that I
want to change, not the whole configuration, say
[Midnight-Commander]
use_internal_edit=true
Before first run, ~/.config/mc/ini doesn't exist.
If ~/.config/mc/ini doesn't exist, /etc/mc/mc.ini is used.
If /etc/mc/mc.ini doesn't exist, /usr/share/mc/mc.ini is used.
You can create one of these files with required default settings set.
Unfortunately, there is no info about /etc/mc/mc.ini in the man page.
I'll fix that at this weekend.

[Jan 01, 2019] Re does mc support sftp

Jan 01, 2019 | mail.gnome.org
  • From : "Yury V. Zaytsev"
  • To : Fourhundred Thecat <400thecat gmx ch>
  • Cc : mc gnome org
  • Subject : Re: does mc support sftp ?
  • Date : Thu, 15 Nov 2018 21:53:25 +0100 (CET)
Yes, it does, if it has been compiled accordingly.
http://www.linux-databook.info/wp-content/uploads/2015/04/MC-02.jpeg
On Thu, 15 Nov 2018, Fourhundred Thecat wrote:
Hello,
I need to connect to server where I don't have shell access (no ssh)
the server only allows sftp. I can connect with winscp, for instance.
does mc support sftp  as well ?
thanks,
_______________________________________________
mc mailing list
https://mail.gnome.org/mailman/listinfo/mc
--
Sincerely yours,
Yury V. Zaytsev

[Jan 01, 2019] Re: Ctrl+J in mc

Jan 01, 2019 | mail.gnome.org

, Thomas Zajic

* Ivan Pizhenko via mc-devel, 28.10.18 21:52
Hi, I'm wondering why following happens:
In Ubuntu and FreeBSD, when I am pressing Ctrl+J in MC, it puts name
of file on which file cursor is currently on. But this doesn't work in
CentOS and RHEL.
How to fix that in CentOS and RHEL?
Ivan.
Never heard about Ctrl+j, I always used Alt+Enter for that purpose.
Alt+a does the same thing for the path, BTW (just in case you didn't
know). :-)
HTH,
Thomas
_______________________________________________
mc-devel mailing list
https://mail.gnome.org/mailman/listinfo/mc-devel

[Jun 14, 2018] Changing shortcuts in midnight commander by rride Last Updated 20:01 PM

Feb 04, 2018 | www.queryxchange.com

I haven't found anything on the topic in the Internet. The only line from .mc/ini that looks related to the question is keymap=mc.keymap but I have no idea what to do with it.

Tags : linux keyboard-shortcuts midnight-commander Okiedokie... lets see
$ man-section mc | head -n20
mc (1)
--
 Name
 Usage
 Description
 Options
 Overview
 Mouse support
 Keys
 Redefine hotkey bindings

8th section... is that possible? Lets look

man mc (scroll,scroll,scroll)

Redefine hotkey bindings
    Hotkey bindings may be read from external file (keymap-file).  A keymap-
    file is searched on the following algorithm  (to the first one found):
     1) command line option -K  or --keymap=
     2) Environment variable MC_KEYMAP
     3) Parameter keymap in section [Midnight-Commander] of config file.
     4) File ~/.config/mc/mc.keymap
     5) File /etc/mc/mc.keymap
     6) File /usr/share/mc/mc.keymap

Bingo!

cp /etc/mc/mc.keymap ~/.config/mc/

Now edit the key mappings as you like and save ~/.config/mc/mc.keymap when done

For more info, read the Keys ( man mc ) section and the three sections following that.

$ cat /home/jaroslav/bin/man-sections
#!/bin/sh
MANPAGER=cat man $@ | grep -E '^^[[1m[A-Z]{3,}'

[Jun 13, 2018] Opening editor in another screen or tmux window

Jun 13, 2018 | www.queryxchange.com

by user2252728 Last Updated May 15, 2015 11:14 AM

The problem

I'm using tmux and I want MC to open files for editing in another tmux window, so that I can keep browsing files while editing.

What I've tried

MC checks if EDITOR variable is set and then interprets it as a program for editing, so if I do export EDITOR=vim then MC will use vim to open files.

I've tried to build on that:

function foo () { tmux new-window "vim $1"; }
export EDITOR=foo

If I do $EDITOR some_file then I get the file open in vim in another tmux windows - exactly what I wanted.

Sadly, when I try to edit in MC it goes blank for a second and then returns to normal MC window. MC doesn't seem to keep any logs and I don't get any error message.

The question(s)

  • Do you know what I'm doing wrong?
  • Do you have a usable workaround for what I want?
  • Should I create a feature request/bug for MC?
Tags : midnight-commander Answers 1 You are defining a shell function, which is unknown for mc when it is trying to start the editor.

The correct way is to create a bash script, not a function. Then set EDITOR value to it, for example:

$ cat ~/myEditor.sh
#!/bin/sh
tmux new-window "vim $1"
export EDITOR=~/myEditor.sh

[Jun 13, 2018] Mcedit is actually a multiwindow editor

Opening another file in editor will create the second window. You can list windows using F9/Window/List\
That allows to copy and paste selections to different files while in editor
Jun 13, 2018 | www.unix.com

Many people don't know that mc has a multi-window text-editor built-in (eerily disabled by default) with macro capability and all sorts of goodies. run

mc -e my.txt

to edit directly.

[Jun 13, 2018] How mc.init is stored

Jun 13, 2018 | superuser.com

The configuration is stored in

$HOME/.config/mc/

In your case edit the file $HOME/.config/mc/ini . You can check which files are actually read in by midnight-commander using strace :

strace -e trace=open -o mclog mc

[Jun 13, 2018] Temporary Do Something Else while editing/viewing a file

Jun 13, 2018 | www.nawaz.org
  • Problem
    I'm viewing/editing a file and I suddenly realize I need to copy a file somewhere. It's a pain to quit the viewer to do this task.
  • Solution
    While viewing/editing, press Alt-`.

[Jun 13, 2018] My Screen is Garbled Up

Jun 13, 2018 | www.nawaz.org
  • Image B_ignoreheading BMCOL
    images/garbled.png
  • Problem B_alertblock BMCOL
    My display got messed up!
  • Solution B_alertblock
    Press \alert{Ctrl-l} to redraw the display.

[Jun 13, 2018] Find file shows no results

Jun 13, 2018 | wiki.archlinux.org

If the Find file dialog (accessible with Alt+? ) shows no results, check the current directory for symbolic links. Find file does not follow symbolic links, so use bind mounts (see mount(8) ) instead, or the External panelize command.

[Jun 13, 2018] Draft of documentation for Midnight Commander

Jun 13, 2018 | midnight-commander.org

Table of content

  1. Introduction
  2. Getting sources
  3. Making and installing?
  4. Ini-options setup?
  5. Usage
  6. Migration to keybindings in 4.8.x series
  7. How to report about bugs
  8. Frequently asked questions

[Jun 13, 2018] Trash support

Jun 13, 2018 | wiki.archlinux.org

Midnight Commander does not support a trash can by default. Using libtrash

Install the libtrash AUR package, and create an mc alias in the initialization file of your shell (e.g., ~/.bashrc or ~/.zshrc ):

alias mc='LD_PRELOAD=/usr/lib/libtrash.so.3.3 mc'

To apply the changes, reopen your shell session or source the shell initialization file.

Default settings are defined in /etc/libtrash.conf.sys . You can overwrite these settings per-user in ~/.libtrash , for example:

TRASH_CAN = .Trash
INTERCEPT_RENAME = NO
IGNORE_EXTENSIONS= o;exe;com
UNCOVER_DIRS=/dev

Now files deleted by Midnight Commander (launched with mc ) will be moved to the ~/.Trash directory.

Warning:
  • Applications launched from mc inherit LD_PRELOAD , which may cause problems with some applications. [1]
  • With GLOBAL_PROTECTION = YES set (default), files deleted outside the home directory are moved to the trash, even if they are on a different partition. Depending on the file, this may cause a significant delay.

See also [2] .

[Jun 13, 2018] Make both panels display the same directory

Jun 13, 2018 | www.fredshack.com

ALT+i. If NOK, try ESC+i

[Jun 13, 2018] Copy and paste text in midnight commander (MC) via putty in Linux

Jun 13, 2018 | www.queryxchange.com

I use Midnight Commander (MC) editor over putty to edit files

I want to know how to copy text from one file, close it then open another file and paste it?

If it is not possible with Midnight Commander, is there another easy way to copy and paste specific text from different files?

I would do it like this:
  1. switch to block selection mode by pressing F3
  2. select a block
  3. switch off block selection mode with F3
  4. press Ctrl+F which will open Save block dialog
  5. press Enter to save it to the default location
  6. open the other file in the editor, and navigate to the target location
  7. press Shift+F5 to open Insert file dialog
  8. press Enter to paste from the default file location (which is same as the one in Save block dialog)

[Jun 13, 2018] How to exclude some pattern when doing a search in MC

Mar 25, 2018 | www.queryxchange.com

In Midnight Commander, is it possible to exclude some directories/patterns/... when doing search? ( M-? ) I'm specifically interested in skipping the .hg subdirectory.

Answers 1 In the "[Misc]" section of your ~/.mc/ini file, you can specify the directories you wish to skip in the "find_ignore_dirs" setting.

To specify multiple directories, use a colon (":") as the delimiter.

[Jun 13, 2018] Midnight Commander tab completion

Sep 17, 2011 | superuser.com
You can get tab-completion by pressing ESC then TAB . You can also get the currently highlighted file/subdir name onto the command line with ESC-ENTER.

[Jun 13, 2018] mc-wrapper does not exit to MC_PWD directory

Jun 13, 2018 | www.queryxchange.com

I recently installed openSUSE 13.1 and set up the mc in typical why by aliasing mc with mc-wrapper.sh to have it exit into the last working directory in mc instance. However this does not seem to be working. I tried to debug the mc-wrapper.sh script - the echo commands.

MC_USER=`id | sed 's/[^(]*(//;s/).*//'`
MC_PWD_FILE="${TMPDIR-/tmp}/mc-$MC_USER/mc.pwd.$$"
/usr/bin/mc -P "$MC_PWD_FILE" "$@"
if test -r "$MC_PWD_FILE"; then
        MC_PWD="`cat "$MC_PWD_FILE"`"
        if test -n "$MC_PWD" && test -d "$MC_PWD"; then
                echo "will cd in : $MC_PWD"
                cd $MC_PWD
                echo $(pwd)
        fi
        unset MC_PWD
fi
rm -f "$MC_PWD_FILE"
unset MC_PWD_FILE
echo $(pwd)

To my surprise, mc-wrapper-sh does change the directory and is in the directory before exiting but back in bash prompt the working directory is the one from which the script was invoked.

Can it be that some bash settings is required for this to work?

Tags : linux bash shell midnight-commander Answers 1 Using answer above working solution for bash shell is this:
alias mc='source /usr/lib/mc/mc-wrapper.sh'

OR

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

[Jun 13, 2018] How to enable find-as-you-type behavior

Jun 13, 2018 | www.queryxchange.com

Alt + S will show the "quick search" in Midnight Commander.

[Jun 13, 2018] How to expand the command line to the whole screen in MC

Jun 13, 2018 | www.queryxchange.com

You can hide the Midnight Commander Window by pressing Ctrl + O . Press Ctrl + O again to return back to Midnight Commander.

[Jun 13, 2018] MC Tips Tricks

Jun 13, 2018 | www.fredshack.com

If MC displays funny characters, make sure the terminal emulator uses UTF8 encoding. Smooth scrolling

vi ~/.mc/ini (per user) or /etc/mc/mc.ini (system-wide):

panel_scroll_pages=0

Make both panels display the same directory

ALT+i. If NOK, try ESC+i

Navigate through history

ESC+y to go back to the previous directory, ESC+u to go the next

Options > Configuration > Lynx-like motion doesn't go through the navigation history but rather jumps in/out of a directory so the user doesn't have to hit PageUp followed by Enter

Loop through all items starting with the same letter

CTRL+s followed by the letter to jump to the first occurence, then keep hitting CTRL+s to loop through the list

Customize keyboard shortcuts

Check mc.keymap

[Jun 13, 2018] MC_HOME allows you to run mc with alternative mc.init

Notable quotes:
"... MC_HOME variable can be set to alternative path prior to starting mc. Man pages are not something you can find the answer right away =) ..."
"... A small drawback of this solution: if you set MC_HOME to a directory different from your usual HOME, mc will ignore the content of your usual ~/.bashrc so, for example, your custom aliases defined in that file won't work anymore. Workaround: add a symlink to your ~/.bashrc into the new MC_HOME directory ..."
"... at the same time ..."
Jun 13, 2018 | unix.stackexchange.com

Tagwint ,Dec 19, 2014 at 16:41

That turned out to be simpler as one might think. MC_HOME variable can be set to alternative path prior to starting mc. Man pages are not something you can find the answer right away =)

here's how it works: - usual way

[jsmith@wstation5 ~]$ mc -F
Root directory: /home/jsmith
[System data]

[User data]
    Config directory: /home/jsmith/.config/mc/
    Data directory:   /home/jsmith/.local/share/mc/
        skins:          /home/jsmith/.local/share/mc/skins/
        extfs.d:        /home/jsmith/.local/share/mc/extfs.d/
        fish:           /home/jsmith/.local/share/mc/fish/
        mcedit macros:  /home/jsmith/.local/share/mc/mc.macros
        mcedit external macros: /home/jsmith/.local/share/mc/mcedit/macros.d/macro.*
    Cache directory:  /home/jsmith/.cache/mc/

and the alternative way:

[jsmith@wstation5 ~]$ MC_HOME=/tmp/MCHOME mc -F
Root directory: /tmp/MCHOME
[System data]

[User data]
    Config directory: /tmp/MCHOME/.config/mc/
    Data directory:   /tmp/MCHOME/.local/share/mc/
        skins:          /tmp/MCHOME/.local/share/mc/skins/
        extfs.d:        /tmp/MCHOME/.local/share/mc/extfs.d/
        fish:           /tmp/MCHOME/.local/share/mc/fish/
        mcedit macros:  /tmp/MCHOME/.local/share/mc/mc.macros
        mcedit external macros: /tmp/MCHOME/.local/share/mc/mcedit/macros.d/macro.*
    Cache directory:  /tmp/MCHOME/.cache/mc/

Use case of this feature:

You have to share the same user name on remote server (access can be distinguished by rsa keys) and want to use your favorite mc configuration w/o overwriting it. Concurrent sessions do not interfere each other.

This works well as a part of sshrc-approach described in https://github.com/Russell91/sshrc

Cri ,Sep 5, 2016 at 10:26

A small drawback of this solution: if you set MC_HOME to a directory different from your usual HOME, mc will ignore the content of your usual ~/.bashrc so, for example, your custom aliases defined in that file won't work anymore. Workaround: add a symlink to your ~/.bashrc into the new MC_HOME directoryCri Sep 5 '16 at 10:26

goldilocks ,Dec 18, 2014 at 16:03

If you mean, you want to be able to run two instances of mc as the same user at the same time with different config directories, as far as I can tell you can't. The path is hardcoded.

However, if you mean, you want to be able to switch which config directory is being used, here's an idea (tested, works). You probably want to do it without mc running:

  • Create a directory $HOME/mc_conf , with a subdirectory, one .
  • Move the contents of $HOME/.config/mc into the $HOME/mc_conf/one subdirectory
  • Duplicate the one directory as $HOME/mc_conf/two .
  • Create a script, $HOME/bin/switch_mc :
    #!/bin/bash
    configBase=$HOME/mc_conf
    linkPath=$HOME/.config/mc
    if [ -z $1 ] || [ ! -e "$configBase/$1" ]; then
        echo "Valid subdirecory name required."
        exit 1
    fi
    killall mc
    rm $linkPath
    ln -sv $configBase/$1 $linkPath
    
  • Run this, switch_mc one . rm will bark about no such file, that doesn't matter.

Hopefully it's clear what's happening there -- this sets a the config directory path as a symlink. Whatever configuration changes you now make and save will be int the one directory. You can then exit and switch_mc two , reverting to the old config, then start mc again, make changes and save them, etc.

You could get away with removing the killall mc and playing around; the configuration stuff is in the ini file, which is read at start-up (so you can't switch on the fly this way). It's then not touched until exit unless you "Save setup", but at exit it may be overwritten, so the danger here is that you erase something you did earlier or outside of the running instance.

Tagwint ,Dec 18, 2014 at 16:52

that works indeed, your idea is pretty clear, thank you for your time However my idea was to be able run differently configured mc's under the same account not interfering each other. I should have specified that in my question. The path to config dir is in fact hardcoded, but it is hardcoded RELATIVELY to user's home dir, that is the value of $HOME, thus changing it before mc start DOES change the config dir location - I've checked that. the drawback is $HOME stays changed as long as mc runs, which could be resolved if mc had a kind of startup hook to put restore to original HOME into – Tagwint Dec 18 '14 at 16:52

Tagwint ,Dec 18, 2014 at 17:17

I've extended my original q with 'same time' condition - it did not fit in my prev comment size limitation – Tagwint Dec 18 '14 at 17:17

[Jun 13, 2018] Editing mc.ini

Jun 07, 2014 | superuser.com
mc / mcedit has a config option called auto_save_setup which is enabled by default. This option automatically saves your current setup upon exiting. The problem occurs when you try to edit ~/.config/mc/ini using mcedit . It will overwrite whatever changes you made upon exiting, so you must edit the ~/.config/mc/ini using a different editor such as nano .

Source: https://linux.die.net/man/1/mc (search for "Auto Save Setup")

[Jun 13, 2018] Running mc with you own skin

Jun 13, 2018 | help.ubuntu.com

put

export TERM="xterm-256color"

at the bottom (top, if ineffective) of your ~/.bashrc file. Thus you can load skins as in

mc -S sand256.ini

In

/home/you/.config/mc/ini

have the lines:

[Midnight-Commander]
skin=sand256

for preset skin. Newer mc version offer to choose a preset skin from within the menu and save it in the above ini file, relieving you of the above manual step.

Many people don't know that mc has a multi-window text-editor built-in (eerily disabled by default) with macro capability and all sorts of goodies. run

mc -e my.txt

to edit directly.

Be aware that many skins break the special characters for sorting filenames reverse up/down unless one works hard with locale parameters and what not. Few people in the world know how to do that properly. In below screenshot you see "arrowdown n" over the filename list to indicate sort order. In many xterm, you will get ??? instead so you might resort to unskin and go to "default skin" setting with ugly colours.

The below CTRL-O hotkey starts what mc calls a subshell. If you run mc a second time in a "subshell", mc will not remind you of the CTRL-O hotkey (as if the world only knows 3 hotkeys) but will start mc with no deeper "subshell" iteration possible, unless one modifies the sources.

[Jun 13, 2018] mcdiff - Internal diff viewer of GNU Midnight Commander

Jun 13, 2018 | www.systutorials.com

mcdiff: Internal diff viewer of GNU Midnight Commander. Index of mcdiff man page
Read mcdiff man page on Linux: $ man 1 mcdiff NAME mcdiff - Internal diff viewer of GNU Midnight Commander. USAGE mcdiff [-bcCdfhstVx?] file1 file2 DESCRIPTION

mcdiff is a link to mc , the main GNU Midnight Commander executable. Executing GNU Midnight Commander under this name requests starting the internal diff viewer which compares file1 and file2 specified on the command line.

OPTIONS
-b
Force black and white display.
-c
Force color mode on terminals where mcdiff defaults to black and white.
-C =,,:= ...
Specify a different color set. See the Colors section in mc (1) for more information.
-d
Disable mouse support.
-f
Display the compiled-in search paths for Midnight Commander files.
-t
Used only if the code was compiled with S-Lang and terminfo: it makes the Midnight Commander use the value of the TERMCAP variable for the terminal information instead of the information on the system wide terminal database
-V
Displays the version of the program.
-x
Forces xterm mode. Used when running on xterm-capable terminals (two screen modes, and able to send mouse escape sequences).
COLORS The default colors may be changed by appending to the MC_COLOR_TABLE environment variable. Foreground and background colors pairs may be specified for example with:
MC_COLOR_TABLE="$MC_COLOR_TABLE:\
normal=lightgray,black:\
selected=black,green"
FILES /usr/share/mc/mc.hlp
The help file for the program.

/usr/share/mc/mc.ini

The default system-wide setup for GNU Midnight Commander, used only if the user's own ~/.config/mc/ini file is missing.

/usr/share/mc/mc.lib

Global settings for the Midnight Commander. Settings in this file affect all users, whether they have ~/.config/mc/ini or not.

~/.config/mc/ini

User's own setup. If this file is present, the setup is loaded from here instead of the system-wide startup file.

[Jun 13, 2018] MC (Midnight Commmander) mc/ini settings file location

Jun 13, 2018 | unix.stackexchange.com

UVV ,Oct 13, 2014 at 7:51

It's in the following file: ~/.config/mc/ini .

obohovyk ,Oct 13, 2014 at 7:53

Unfortunately not... – obohovyk Oct 13 '14 at 7:53

UVV ,Oct 13, 2014 at 8:02

@alexkowalski then it's ~/.config/mc/iniUVV Oct 13 '14 at 8:02

obohovyk ,Oct 13, 2014 at 8:41

Yeah, thanks!!! – obohovyk Oct 13 '14 at 8:41

,

If you have not made any changes, the config file does not yet exist.

The easy way to change from the default skin:

  1. Start Midnight Commander
    sudo mc
    
  2. F9 , O for Options, or cursor to "Options" and press Enter
  3. A for Appearance, or cursor to Appearance and press Enter

    You will see that default is the current skin.

  4. Press Enter to see the other skin choices
  5. Cursor to the skin you want and select it by pressing Enter
  6. Click OK

After you do this, the ini file will exist and can be edited, but it is easier to change skins using the method I described.

[Jun 13, 2018] Hide/view of hidden files

Sep 17, 2011 | superuser.com

Something I discovered which I REALLY appreciated was the hide/view of hidden files can be toggled by pressing ALT-. (ALT-PERIOD). Be aware that often the RIGHT ALT key is NOT seen as an ALT key by the system, so you usually need to use Left-ALT-. to toggle this. I forgot about the Right-ALT weirdness and thought I'd broken mc one day. {sigh} Such a blonde...

Just checked (xev!), I guess the ALT-. toggle is mapped to ALT_L-., and the right ALT key gives an ALT_R keycode... which doesn't match the mc mapping, causing it to not work... now I know why! Hooray!

[Jun 13, 2018] Loss of output problem

Sep 17, 2011 | superuser.com
1) If the panels are active and I issue a command that has a lot of output, it appears to be lost forever.

i.e., if the panels are visible and I cat something (i.e., cat /proc/cpuinfo), that info is gone forever once the panels get redrawn.

If you use Cygwin's mintty terminal, you can use its Flip Screen context menu command (or Alt+F12 shortcut) to switch between the so-called alternate screen, where fullscreen applications like mc normally run, and the primary screen where output from commands such as cat appears.

[Jun 13, 2018] I Can't Select Text With My Mouse

Jun 13, 2018 | www.nawaz.org

I Can't Select Text With My Mouse

  • Problem
    I can't select text with my mouse!
  • Solution
    • Hold down the Shift button while selecting your text.
    • Do likewise when pasting with the mouse.

[May 20, 2018] Midnight Commander (mc): convenient hard links creation from user menu

Notable quotes:
"... Future Releases ..."
May 20, 2018 | bogdan.org.ua

3rd December 2015

Midnight Commander is a convenient two-panel file manager with tons of features.

You can create hard links and symbolic links using C-x l and C-x s keyboard shortcuts. However, these two shortcuts invoke two completely different dialogs.

While for C-x s you get 2 pre-populated fields (path to the existing file, and path to the link – which is pre-populated with your opposite file panel path plus the name of the file under cursor; simply try it to see what I mean), for C-x l you only get 1 empty field: path of the hard link to create for a file under cursor. Symlink's behaviour would be much more convenient

Fortunately, a good man called Wiseman1024 created a feature request in the MC's bug tracker 6 years ago. Not only had he done so, but he had also uploaded a sample mc user menu script ( local copy ), which works wonderfully! You can select multiple files, then F2 l (lower-case L), and hard-links to your selected files (or a file under cursor) will be created in the opposite file panel. Great, thank you Wiseman1024 !

Word of warning: you must know what hard links are and what their limitations are before using this menu script. You also must check and understand the user menu code before adding it to your mc (by F9 C m u , and then pasting the script from the file).

Word of hope: 4 years ago Wiseman's feature request was assigned to Future Releases version, so a more convenient C-x l will (sooner or later) become the part of mc. Hopefully.

[May 20, 2018] Midnight Commander: panelize or select all files newer than specified date

May 20, 2018 | bogdan.org.ua

3rd February 2017

If you ever need to select lots (hundreds, thousands) of files by their modification date, and your directory contains many more files (thousands, tens of thousands), then angel_il has the answer for you:
  1. touch -d "Jun 01 00:00 2011″ /tmp/.date1
  2. enter into your BIG dir
  3. press C-x ! (External panelize)
  4. add new command like a "find . -type f \( -newer /tmp/.date1 \) -print"

I've used a slightly different approach, specifying desired date right in the command line of External Panelize:

  1. enter your directory with many files
  2. press C-x ! (External Panelize)
  3. add a command like find . -type f -newermt "2017-02-01 23:55:00" -print ( man find for more details)

In both cases, the created panel will only have files matching your search condition.

[Oct 05, 2017] How can I set the default (user defined) listing mode in Midnight Commander?

Jul 14, 2016

papaiatis

I defined my own listing mode and I'd like to make it permanent so that on the next mc start my defined listing mode will be set. I found no configuration file for mc.

1 Answer 1

You have probably Auto save setup turned off in Options->Configuration menu.

You can save the configuration manually by Options->Save setup.

Panels setup is saved to ~/.config/mc/panels.ini

mc - Midnight Commander file size format

Unix & Linux Stack Exchange

You can adjust the displayed digits with the column size option, see the "Listing mode" section in the manual. The file to edit is ~/.config/mc/panels.ini.

To list the file sizes as K, M or G use a narrow size column using the user_format key:

[New Left Panel]
user_format=half type name mark size:4 space mtime

If you want the size without abbreviation, reserve enough space for it:

[New Right Panel]
user_format=half type name mark size:16 space mtime
share|improve this answeranswered May 23 '13 at 16:55

Marco

21.8k56897 but this will not display the filesize as: 123,456,789 –

user1968963 May 23 '13 at 17:01

You didn't exactly specify what you want, you said "nicely formatted". What is wrong with this, is it the missing comma?

user1968963 May 23 '13 at 17:43

[Jun 29, 2017] An Introduction to the Midnight Commander

  • Home, or Alt-< - move to the top of the directory listing
  • End, or Alt-> - move to the end of the directory listing

[Mar 29, 2017] SDB: Midnight Commander tips

openSUSE
Using the mouse

Although Midnight Commander is a text mode application it can make use of mouse. The openSUSE delivered mc will make use of the mouse when used with a GUI console, without any further configuration needed.

The text mode terminal that we get when booting in runlevels 2 or 3 is a bit different story. You have to install the package gpm ("general purpose mouse") which is also called mouse server. The gpm is used in Linux to receive movements and clicks from mouse. Start gpm and then start Midnight commander.

If you come to the text terminal using Ctrl + Alt + F1, then gpm will not work as another driver that belongs to GUI (X Server) claims control over the mouse.

... ... ...

FTP browsing

This is file browsing on remote FTP server just as it is on your computer.

  1. Press F9 to select drop down menus on the top of the screen.
  2. Press Alt + L if you want to use left side panel, or Alt + R for right panel.
  3. Press Alt + P for input box where you have enter server name. Enter for instance
ftp.gwdg.de/pub

and press Enter.

Now mc will try anonymous connection to remote machine. If machine responds, you'll get directory listing of /pub on remote server.

It is possible to do the same from mc command line by typing:

cd /#ftp:ftp.gwdg.de/pub

Archive browsing

Archive in classic meaning is compressed file. In Linux you can recognize them by suffix like:

tgz, tar.gz, tbz, tar.bz2

and many more, but above few are the most used

  1. Highlight the file
  2. Press Enter

That's it. Midnight Commander will decompress file for you and present it's internal structure like any other directory. If you want to extract one or all files from archive mark what you want toextract and use F5 to copy in another panel. Done.

RPM browsing

The package installation files for any SUSE are RPM and mc will let you browse them.

  1. Highlight the file
  2. Press Enter

You'll see few files:

/INFO
CONTENTS.cpio
HEADER
*INSTALL
*UPGRADE

Browse to see details of your RPM.

The CONTENTS.cpio is actual archive with files, and if you want to see within:

  1. Highlight the file
  2. Press Enter

(You know the drill)

The *INSTALL and *UPGRADE will do what the name tells, but if you want only to extract one or more files from CONTENTS.cpio than use F5 to copy them in the directory in the other panel.

PuTTY and line drawing

PuTTY is terminal application used to access remote computers running Linux via ssh (SSH tunnels from Microsoft Windows see details). The line drawing in Midnight Commander, YaST and another applications that draw lines using special characters can be displayed wrong as something else. The solution is to change settings:

  • menu: Window > Translation:
    • Received data assumed to be in which character set: UTF-8
    • Handling of line drawing characters: Use Unicode for line drawing

If that doesn't help, you may set this too:

  • menu: Connection > Connection-type string: linux
  • menu: Terminal > Keyboard > The Function keys and keypad: Linux

Found on webmilhouse.com.

User menu (F2 key) add-on

Diffs in color

Tip by James Ogley:

+ t r & ! t t
d       Diff against file of same name in other directory
        if [ "%d" = "%D" ]; then
          echo "The two directores must be different"
          exit 1
        fi
        if [ -f %D/%f ]; then        # if two of them, then
          diff -up %f %D/%f  sed -e 's/\(^-.*\)/\x1b[1;31m\1\x1b[0m/g' \
                                  -e 's/\(^\+.*\)/\x1b[1;32m\1\x1b[0m/g' \
                                  -e 's/\(^@.*\)/\x1b[36m\1\x1b[0m/g'  less -R
        else
          echo %f: No copy in %D/%f
        fi
D       Diff current directory against other directory
        if [ "%d" = "%D" ]; then
          echo "The two directores must be different"
          exit 1
        fi
        diff -up %d %D  sed -e 's/\(^-.*\)/\x1b[1;31m\1\x1b[0m/g' \
                             -e 's/\(^\+.*\)/\x1b[1;32m\1\x1b[0m/g' \
                             -e 's/\(^@.*\)/\x1b[36m\1\x1b[0m/g'  less -R
fi

[Feb 11, 2017] Use Midnight Commander like a pro

May 1, 2015 klimer.eu

Use Midnight Commander like a pro

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:

  • 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 mc. mc has the ability to exit to its current directory. Meaning, you can navigate the filesystem using mc (sometimes it's easier than cping 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
  • Insert (Ctrl + t alternatively) - select files (for example, for copying, moving or deleting).
  • + - select files based on a pattern.
  • \ -unselect files based on a pattern.
  • * - reverse selection. If nothing was selected, all files will get selected.
Accessing the shell
  • 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).
  • Since Tab is bound to switching panels (or moving the focus in dialogs), you have to use Esc Tab to 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 mc in the background but with a nice perk. Your current working directory from mc will be passed on to the shell and vice versa! Hit Ctrl + o again to return to mc.
  • Ctrl + Enter or Alt + Enter - copy the currently selected file's name to the shell.
  • Ctrl + Shift + Enter - same as above, but the full path is copied.
Internal viewer (F3) and editor (F4)
  • 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 (coughvimcough). You can do so by setting the PAGER (for viewer) and EDITOR (for editor) variables (for example, in your ~/.bashrc file). Then toggle the Options -> Configuration -> Use interal edit/view option (access the top menu by pressing F9).
Panels
  • 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.
Searching files
  • Alt + ? - shows the full Find dialog.
  • Alt + s or 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.
Common actions
  • 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 s to l for 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 chmod dialog.
  • Ctrl + x o - open the chown dialog.
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
  • Configuration
    • Verbose operation and Compute totals - so that operations like copy/move have a more detailed progress dialogs.
  • Layout
    • 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).
    • Uncheck Hintbar visible - one more line available, one less line of noise.
  • Panel options
    • Show backup files and 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 Home, Enter, Home, 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 highlight -> File types is 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.
  • ... ... ...
Bonus assignments
  • Define your own listing mode (Right/Left -> Listing mode... -> User defined). Hit F1 to see available columns and options.
  • Play around in tree mode: Right/Left -> Tree or Command -> Directory tree.
  • 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 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!

SFTP filesystem in Midnight Commander 4.8.17 and later

The SFTP file system is a network based file system that allows you to
manipulate the files in a remote machine as if they were local.

To connect to a remote machine, you just need to chdir into a special directory
which name is in the following format:

sftp://fuser@dnsname:[port]/[remote-dir]

The user, port and remote-dir elements are optional. If you specify the user
element, the Midnight Commander will try to login on the remote machine as that
user, otherwise it will use your login name, port - specify the port used by
remote server (22 by default). If the remote-dir element is present, your
current directory on the remote machine will be set to this one.

Examples:

sftp://onlvrsh.mx/linux/local
sftp://joe:password@want.compression.edu/private
sftp://joe@pclab.university.edu/private
sftp://joe@somehost.university.edu:2222/private

SDB: Midnight Commander tips

openSUSE
Using the mouse

Although Midnight Commander is a text mode application it can make use of mouse. The openSUSE delivered mc will make use of the mouse when used with a GUI console, without any further configuration needed.

The text mode terminal that we get when booting in runlevels 2 or 3 is a bit different story. You have to install the package gpm ("general purpose mouse") which is also called mouse server. The gpm is used in Linux to receive movements and clicks from mouse. Start gpm and then start Midnight commander.

If you come to the text terminal using Ctrl + Alt + F1, then gpm will not work as another driver that belongs to GUI (X Server) claims control over the mouse.

... ... ...

FTP browsing

This is file browsing on remote FTP server just as it is on your computer.

  1. Press F9 to select drop down menus on the top of the screen.
  2. Press Alt + L if you want to use left side panel, or Alt + R for right panel.
  3. Press Alt + P for input box where you have enter server name. Enter for instance
ftp.gwdg.de/pub

and press Enter.

Now mc will try anonymous connection to remote machine. If machine responds, you'll get directory listing of /pub on remote server.

It is possible to do the same from mc command line by typing:

cd /#ftp:ftp.gwdg.de/pub

Happy browsing.

Archive browsing

Archive in classic meaning is compressed file. In Linux you can recognize them by suffix like:

tgz, tar.gz, tbz, tar.bz2

and many more, but above few are the most used

  1. Highlight the file
  2. Press Enter

That's it. Midnight Commander will decompress file for you and present it's internal structure like any other directory. If you want to extract one or all files from archive mark what you want toextract and use F5 to copy in another panel. Done.

RPM browsing

The package installation files for any SUSE are RPM and mc will let you browse them.

  1. Highlight the file
  2. Press Enter

You'll see few files:

/INFO
CONTENTS.cpio
HEADER
*INSTALL
*UPGRADE

Browse to see details of your RPM.

The CONTENTS.cpio is actual archive with files, and if you want to see within:

  1. Highlight the file
  2. Press Enter

(You know the drill)

The *INSTALL and *UPGRADE will do what the name tells, but if you want only to extract one or more files from CONTENTS.cpio than use F5 to copy them in the directory in the other panel.

PuTTY and line drawing

PuTTY is terminal application used to access remote computers running Linux via ssh (SSH tunnels from Microsoft Windows see details). The line drawing in Midnight Commander, YaST and another applications that draw lines using special characters can be displayed wrong as something else. The solution is to change settings:

  • menu: Window > Translation:
    • Received data assumed to be in which character set: UTF-8
    • Handling of line drawing characters: Use Unicode for line drawing

If that doesn't help, you may set this too:

  • menu: Connection > Connection-type string: linux
  • menu: Terminal > Keyboard > The Function keys and keypad: Linux

Found on webmilhouse.com.

User menu (F2 key) add-on

Diffs in color

Tip by James Ogley:

+ t r & ! t t
d       Diff against file of same name in other directory
        if [ "%d" = "%D" ]; then
          echo "The two directores must be different"
          exit 1
        fi
        if [ -f %D/%f ]; then        # if two of them, then
          diff -up %f %D/%f  sed -e 's/\(^-.*\)/\x1b[1;31m\1\x1b[0m/g' \
                                  -e 's/\(^\+.*\)/\x1b[1;32m\1\x1b[0m/g' \
                                  -e 's/\(^@.*\)/\x1b[36m\1\x1b[0m/g'  less -R
        else
          echo %f: No copy in %D/%f
        fi
D       Diff current directory against other directory
        if [ "%d" = "%D" ]; then
          echo "The two directores must be different"
          exit 1
        fi
        diff -up %d %D  sed -e 's/\(^-.*\)/\x1b[1;31m\1\x1b[0m/g' \
                             -e 's/\(^\+.*\)/\x1b[1;32m\1\x1b[0m/g' \
                             -e 's/\(^@.*\)/\x1b[36m\1\x1b[0m/g'  less -R
fi

Diff viewer 4.7.2

A built-in tool to visual compare and merge two files (#120, #2159)

[Mar 14, 2016] Macros in McEdit

To define a macro, press Ctrl-R and then type out the keystrokes you want to be executed..
Press Ctrl-R again when finished..
You can then assign the macro to any key you..
        like by pressing that key..
The macro is executed  by: Ctrl-A and then the assigned key.
===========
The simple example is to delete all "=" [from current cursor - forward].
The = function of mcedit is the basis of the macro.
So:
Ctrl-r
  =  o l 
 
Ctrl-r
=========

[Mar 14, 2016] Ctrl+w clears the editboxes and Meta+h triggers the history drop-down

[Dec 06, 2015] www.trembath.co.za/mctutorial.html

Years ago I wrote an mc tutorial which gets 90% of the traffic on my website. Hope it is of use to you, Bryce.

[Dec 06, 2015] Garbled graphic characters in mc on particular terminal

You should first try to use export LANG=C mc that might help.
mc usually works out of the box on Xfce Terminal, the gnome terminal and xterm.
Midnight Commander works great with URxvt, the unicode version of rxvt.

Daryl Styrk, 3/1/09

Frank McCormick wrote:

> What's the best terminal for running Midnight Commander...it seems all
> the ones I try ( rxvt, aterm) can't handle the acsii drawing characters
> so the display is wierd.

I've never used Midnight Commander, but here is my notes on how I got the BBS's to display much better..

cd /usr/share/fonts/X11/misc
wget http://home.earthlink.net/~us5zahns/enl/vga11x19.pcf
mkfontdir
xset fp rehash

## need rxvt ##

rxvt -bg black -fg white -fn vga11x19

##from http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x606.html ##

Maybe that will get you somewhere.. Hope this helps.

Daryl

Midnight Commander works great with URxvt, the unicode version of rxvt.

The Debian package I have installed is 'rxvt-unicode.' There are two other packages that may work as well, 'rxvt-unicode-light' and 'rxvt-unicode-ml' (the latter for multilingual support). This is with Lenny.

[Dec 06, 2015] ALT+S or CTRL+S for file searching

My other tip: ALT+S or CTRL+S for file searching.

Allows searching for names - with wildcards: Example: CTRL+S then sy jumps to first file starting with sy CTRL+S then *sy jumps to first file containing sy

Further presses of CTRL+S jump to next matching file

If your keyboard or terminal does not have function keys: ESC [num] does equivalent of F[num] Example: to exit mc hit ESC then 0 (same as F10) But why would you ever want to do that?

[Dec 06, 2015] mc - How to set default editor-viewer for Midnight Commander to Sublime

If you want specific editor for specific type of file, the config file 'mc.ext' provides the opportunity to bind a command to the actions: Open ([enter]), View ([F3]) and Edit ([F4]).
You can have both: the build in editor at [F4] being a fall back in lack of X and your preferred GUI-editor on just hitting [enter]. That needs some shell-script skills.
MattDMo Jun 27 '13 at 16:07
Because other tools, for example crontab, are using it. Such tools may be used without X (for example from a virtual terminal in single user mode for maintenance operations) or by user who has no running X instance (for example through su -). So better keep EDITOR set to a text mode editor.
manatwork Jun 27 '13 at 16:12
Why 'EDITOR='sublime -w' does not work? (It seems MC ignore any supplied options) –
Eugen Konkov Sep 14 at 9:31
Run MC as usual. On the command line right above the bottom row of menu selections type
select-editor

This should open a menu with a list of all of your installed editors. This is working for me on all my current Linux machines.

[Dec 06, 2015] Lynx-like motion

On Sat, 2015-11-21 at 19:00 +0200, Kertész Zoltán wrote:
Hi :)

I'd like to share one tip regarding mc.

mc is the first program always to install on a new Linux, and the following setting is the first to make to mc once installed.

Navigate to Options/Panel options and there (on the top right) at Navigation tick "Lynx-like motion".

What this does it activates the navigation within mc with the four arrow keys (up and down the tree, left is out of and right is into a folder). It is called Lynx-like motion as the Lynx text based browser has this - I have to admit - really intuitive way of navigating.

It comes extremely handy on headless systems, speeding up getting around in mc. I found that this is really handy, try it and see if you find it useful too :)

Cheers,

Zoli

[Mar 20, 2015] Re: mc.keymap

Jan 14, 2015

From: Frank Dietrich

Hello Chris,

chris glur wrote:

locate mc.keymap == nX
man mc -> seek keymap = nX
Where's mc.keymap ?

Following "man mc" the file is searched in below directories in the given order

1) ~/.config/mc
2) /etc/mc/
3) /usr/share/mc/
"Initially, Mignight Commander creates key bindings using keymap defined in the source code. Then, two files /usr/share/mc/mc.keymap and /etc/mc/mc.keymap are loaded always, ..."

If on your system the file does not exist at any location, you should create one or take one from the source and modify it.

cheers, Frank

[Feb 09, 2015] If you put the program you want to test on the left (passive panel) and file that this program works with on the right (active panel) you can have a shortcut for testing.

For example for Perl you can put the following command in the user menu:

perl %D/%F %d/%f

[Feb 09, 2015] There is the ScreenList functionality in MC bound by default to Alt-Prime(`)

Message: 1
Date: Thu, 1 Jan 2015 17:13:58 +0100
From: Jack Epps 
To: mc@gnome.org
Subject: ScreenList functionality
Message-ID:
	
Content-Type: text/plain; charset=UTF-8
Hi,
there is the ScreenList functionality bound by default to Alt-Prime
(`) in the default mc.keymap:
ScreenList = alt-prime
Pressing the combination displays "Screens" dialog, which says
"Panels" in the actual listing.
How to add panels or screens?
--
Best Regards,
Jack Epps

[Jan 18, 2015] How can I create file in mc? shift+f4 not working

1/13/2015  Andrew Samoilov
Hello,
Use F9 - Options - Learn Keys.
P.S. If Shift-F4 is move file for you, use Shift-F2
On Mon, Jan 12, 2015 at 3:30 PM, Mike Smithson  wrote:
 Message: 2
Date: Wed, 24 Dec 2014 20:47:07 +0600
From: "Igor"
To: mc-devel@gnome.org
Subject: error or i don't understend some thing
Message-ID:
        4r_g@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
hello, my name is Igor i have a question
how can i create file in mc? shift+f4 not working
now i using echo > flie.name in terminal mode(ctrl+o)
mc version 4.8.11
os ubuntu 14.04
shift+F4 is "move file" for me. If I want to edit a new file
I type "vim file" and hit enter. After that F4 will edit it if
it exists. "touch file" will also create new empty file (easier
to type than "echo > file).
--
Peace and Cheer

[Jan 12, 2015] opening *.xz files (Kevin Wilson)

HI Kevin,
Kevin Wilson  wrote:
Is there a way to open *.xz files in mc ?
If the file command indetifies them as "XZ compressed data" then it
works out of the box (IIRC since version 4.7.0).
when I open mc, and navigate to a folder where there are compressed
files (for example, in *.tar.gz format), pressing enter on these
compressed files opens them temporarily.
If I do it on *.xz files, then garbage is displayed.
To "change into" such file it must contain an archive of a directory
structure, for example *.tar.xz. If the file *.xz contains only is a
single compressed file you can only view the uncompressed file
(pressing F3).
F9 -> C ->  shows me:-
# .tar.xz, .txz
regex/\.t(ar\.xzxz)$
        Open=%cd %p#utar
        View=%view{ascii} xz -dc %f 2>/dev/null  tar tvvf -
.....
regex/([^0-9]^[^\.]*)\.([1-9][A-Za-z]*[ln])\.xz$
        Open=case %d/%f in */log/**/logs/*) xz -dc %f ;; *) xz -dc %f  nroff -
        View=%view{ascii,nroff} case %d/%f in */log/**/logs/*) xz -dc %f ;; *)
...  and more ...
Yes: good explanation.------
File: mc.ext    Line 629 Col 1   16958 bytes                100%
# xz
regex/\.xz$
        Open=xz -dc %f  %var{PAGER:more}
        View=%view{ascii} xz -dc %f 2>/dev/null
===
-> which xz == /usr/bin/xz
So I'd expect: `xz -dc SomeFile.xz` to  the expanded file
in a terminal, and for mc to show via .
On 12/29/14, mc-request@gnome.org  wrote:
Send mc mailing list submissions to
	mc@gnome.org
To subscribe or unsubscribe via the World Wide Web, visit
	https://mail.gnome.org/mailman/listinfo/mc
or, via email, send a message with subject or body 'help' to
	mc-request@gnome.org
You can reach the person managing the list at
	mc-owner@gnome.org
Whening, please edit your Subject line so it is more specific
than "Re: Contents of mc digest..."
Today's Topics:
   1. Re: opening *.xz files (basti)
----------------------------------------------------------------------
Message: 1
Date: Sun, 28 Dec 2014 14:49:03 +0100
From: basti 
To: mc@gnome.org
Subject: Re: opening *.xz files
Message-ID: <54A00A4F.2070302@arcor.de>
Content-Type: text/plain; charset=ISO-8859-1
Hello,
I'm no expert but i would say this depends on the file which is compressed.
First of all you need xz-utils installed.
I can't open an xz compressed dd image in mc BUT
I can open an xz compressed text file in mc.
In /etc/mc or in ~/.config/mc is an mc.ext file which define the file
extensions handled by mc.
I hope that would help you.
Best regards,
Basti
Am 28.12.2014 12:43, schrieb Kevin Wilson:
Hi,
Is there a way to open *.xz files in mc ?
when I open mc, and navigate to a folder where there are compressed
files (for example, in *.tar.gz format), pressing enter on these
compressed files opens them temporarily.
If I do it on *.xz files, then garbage is displayed.
Any ideas ?
Regards,
Kevin
4>

[Jan 12, 2015] Re: mc on high resolution monitor with konsole

On Sat, 27 Dec 2014 16:11:34 -0800, Outback Dingo wrote:
ive got a samsung 4k, running kde in the proper mode, however in konsole
when i launch mc

it only fills 1/3 of the screen... how can i get it to be full screen? ive
attached an image

How many $COLUMNS in that window? 500 or something? I thought I was getting
out of hand with 236 on 1920x1080. :)

Check F9-> Options -> Layout. It looks like mc is not expecting a super-wide
screen and thinks it's in 80 column mode or something. Note that with really
wide screen like that your scrolling may be slow. You may want to use smaller
terminal window, or much bigger font.

Also, sending SIGWINCH to mc may help fix it automatically: try un-maximizing
the window, then re-maximizing it. mc may adjust properly. Then SAVE the
options so it remembers for next time.

[Jan 12, 2015] Re: External editor with parameters not working?

On Sat, 06 Dec 2014 03:14:38 -0800, Stevko wrote:
Hello.

I tried the following thing:
1) export EDITOR="emacs -nw"
2) mc
3) (with internal editor disabled) go to some file and press F4

This opens emacs with the file, however it does not open it in terminal (which should be done with -nw switch) but in new window in X. (as if it somehow ignored -nw). If I run the following in shell:

$EDITOR file

it opens file as expected. Why does mc not do that?

I tried setting EDITOR to "vim -R" and again when run from mc, it does
not honor -R switch.

I have version 4.8.12 (which comes from Fedora 21 package).

Stevko

I am not subscribed to mailing list (so sendalso to me).
_______________________________________________
mc mailing list
https://mail.gnome.org/mailman/listinfo/mc


Hello Stevko.

I recall being confounded by this very thing.

In my mc/ini file ($HOME/.config/mc/ini)

I have this:

[External editor or viewer parameters]
vi=%filename +%lineno
vim=%filename +%lineno
ed=+%lineno %filename
/bin/mo=%filename +%lineno
mo=+%lineno %filename
less=%filename +%lineno
joe=%filename +%lineno
more=%filename +%lineno

You can add the command line options here.
It seems mc doesn't *really* call $EDITOR.

Re: How to know when mc is running in a terminal

Mon, 10 Nov 2014 13:21:39 -0800 (PST)
Date: Mon, 10 Nov 2014 13:21:25 -0800
From: Mike Smithson 
Subject: Re: How to know when mc is running in a terminal
In--to: <54608E22.9090600@gmail.com>
Sender: mc 
To: "mc@gnome.org" 
Errors-to: mc-bounces@gnome.org
Message-id: 

On 11/10/2014 4:21 PM, Mike Smithson wrote:

Thanks frank. The answer was in front of my nose the whole time.

Environment variable MC_TMPDIR can be used to know that you're being
called from mc. For some reason MC_SID disappears but MC_TMPDIR does
not.

I needed something more specific than just knowing whether I'm
in pts or not. I want to know if it's mc's F4 EDIT command calling, or
at least being called from a terminal with mc running in it.

if [ -n "$DISPLAY" -a -n "$MC_TMPDIR" ]; then
# we're being called from mc in XWindow terminal
do_something_odd
fi


On Mon, 10 Nov 2014 02:06:26 -0800, frank wrote:

On 10/11/2014 01:25, Mike Smithson wrote:

how can a script know whether it is being called from F4 in mc or just a terminal?
Try the shell command 'tty'. In the Linux console it wille.g. /dev/tty1. In a graphic terminal thewill be /dev/pts/0.

linux mc keyboard shortcuts

Ctrl+o toggle panes on/off
Ctrl+l redraw screen This is on all terminals
Ctrl+PgUp goto parent dir
Ctrl+Enter copy selected filename to command line %f is equivalent
Ctrl+x+p copy unselected panel's path to command line %D is equivalent

MC Tutorial

All shortcuts are noted in the menus. In mc's keyboard shortcut notation, 'C-x i' would mean press Ctrl and x simultaneously, release both then press i. M refers to the Alt key. A few common shortcuts:

• Ctrl R - refresh or rescan directory view
• Alt-shift ? - find file
• Ctrl-x d - compare directories (release ctrl-x before pressing d)
• Ctrl \ - open directory hotlist
• Ctrl-x c (o,s,l) - chmod, chown, symlink, link
• Alt c - quick cd (opens a box, quicker to type than arrowing through if you know its full path)
• (Shift) + - select group. Can enter wildcards to highlight a certain type or name of file.
• (Shift) * - reverse selection. Changes highlighting to all unselected files. Handy to use these two in combination if you are trying to quickly select all but a certain group.
• \ - unselect group. Opposite of +.

The command line

Although I don't use the command line much in mc, it should execute whatever you have typed into it. If you wish to su, it will return you to the terminal to type in your password. Then relaunch mc as root; if you ctl-o, it will take you back as user.

While anything remains typed into the command line, the sideways arrow keys move through the text and won't work to navigate in the panels. If your arrow keys suddenly don't work, check and clear the command line.

To scroll back and forth through command history, use alt - p for previous and alt - n for next command instead of the the up and down arrow keys (as in the terminal window), since mc uses them for navigating.

[Oct 28, 2013] Re: behavior changed.

From: lists@homerow.info

On 2013-10-10 James Wonnacott wrote:

I've recently built a couple of Debian 7.1 boxes and installed mc using the package manager, all works fine except that mouse clicking at the top of the panel changes the sort order rather than scrolling up, as it used to.

I didn't even know you can use the mouse in mc.

I find this very confusing!

Not that I ever used it myself, but I'd argue that it's a common idiom. Clicking the table head reverses the sort order and the mouse wheel is used for scrolling.

Marco

[Oct 28, 2013] mc startup with single specified path

From: mdooligan@gmail.com

Q:

Hello.

I'm having some puzzlement over the initial startup behavior of mc-4.8.10 when paths are specified on the command line.

To quote the manual:

[quote]
If both paths are specified, the first path name is the directory to
show in the left panel; the second path name is the directory to be
shown in the right panel.

If one path is specified, the path name is the directory to show in the
active panel; current directory is shown in the passive panel.

If no paths are specified, current directory is shown in the active
panel; value of "other_dir" from panels.ini is the directory to be
shown in the passive panel.
[/quote]

Paragraph #1:
This seems correct and intuitive.

Paragraph #2:
What I *expect* to happen when I specify only one path on the command line, is for that directory to appear in the left panel with the focus on it. As it works right now, it appears to be random which panel it shows up in, and which panel has focus. I know that it depends on the last time I hit "Save Setup" and the setting of current_is_left in panels.ini, but it always seems to do the wrong thing. As a matter of fact, the behavior I'm witnessing, is that that specified directory appears in the *inactive* panel, and the CWD appears in the *active* panel. I think that is counter-intuitive, a bit annoying, and exactly *not* what the manual says.

Paragraph #3:
This also seems correct and intuitive. Resort to default behavior if nothing is specified.

A:

Please start with looking around in the bugtracker or compiling the
development version next time :)  The issue is already fixed for the
forthcoming 4.8.11.

[Oct 27, 2013] re: How to switch two -> single panel modes?

From: mdooligan@gmail.com

Hello.
Does anyone know how to hide the second panel in one keyboard hot key?
Currently, we may do this by pressing  three times and manually set
user_format (from "panels.ini") from
user_format=full name type size:4
to
user_format=half name type size:4
and vice versa.
Thanks.
I don't know of a way, but ALT-T seems to cycle through the Listing Modes:
Full File List
Brief File List
Long File List list_type)
    {
    case list_long:
        return "full perm space nlink space owner space group space size space mtime space name";
    case list_brief:
        return "half 2 type name";
    case list_user:
        return panel->user_format;
    default:
    case list_full:
        return "half type name  size  mtime";
    }
}
Perhaps sometime in the misty past, the user was allowed to define these himself, instead of being hard-coded. Come to think of it, that would be a nice feature.

[Apr 11, 2013] MC major changes and fixes since 4.8.7

What is funny is that the web page for Midnight Commander does not have a link to a stable release. I am assuming that all releases are now unstable ;-). In reality the last (more or less) stable version 4.8.1.7
Core:
  • Make copy/move progress dialog window wider up to 2/3 of screen width (#2076)
  • Ask file name before create new file in editor (#2585)
  • Support newer extended mouse protocol SGR-1006 instead of URXVT-1015 (#2956)
  • Allow skip directory scanning before file operation. Print directory count and size in addition to directory name (#2101)
  • Add jump support to target line in some external editors and viewers (#2206)

[Mar 28, 2013] Re midnight commander internal cd in scripts

On Fri, 22 Feb 2013 20:16:17 +0200 Elad Rom wrote:
Is there a way to cd into a folder (be it ssh, ftp or local folders)
from an existing instance of midnight commander through a shell script?
Example:
Inside an open MC instance, in my home folder, there is a file called "somessh.sh".
When I hit enter on this executable, I want mc to cd into the directory I specify inside the file (E.g.
~/Downloads)
as if I'm using the cd in the mini-command line or via quick cd.
When you run shell script, you run new shell which is child process of MC.
When you do cd in the script, you change working directory of that child
shell. Working directory of parent is unchanged. You unable to change working
directory of parent from child.
You have to use the "source" built-in shell command to run script in current
process context. This allows you change current directory from script.

[Mar 28, 2013] Re nlink

On Fri, 04 Jan 2013 18:48:09 +0000
frank  wrote:
In Midnight Commander, nlink is supposed to be the number of symlinks
to a file. So far so good.
hardlinks? You can't count amount of symlinks to a file without
probing every file on your filesystem to be a symlink on requested file.
Hardlinks to a new dir come from 2 nodes:
- '$your_dir/..'
- '$your_dir/.'
'stat -c%h /path/to/dir' should show the same value.
But I have created a new subdir '123456789' in my home directory for which I have to assume no symlinks exist.

Well, MC says nlink is 2 in this case. Where are those two symlinks?

Should be not different from 'stat' call.

[Mar 28, 2013] Re external diff

In reality external diff can be implemented via user menu.
On Wed, 28 Nov 2012 19:42:47 +0100 Frank Dietrich wrote:
is it possible to configure an external diff tool?
I would like to use meld in case I need to diff a directory.
Current I do it like this
  in panel1: cd ..
  in panel2: cd ..
  type command 'meld '
  in panel2: CTRL-SHIFT-ENTER
  in panel1: CTRL-SHIFT-ENTER
  press ENTER to execute the command
I would like to reduce the number of steps needed to compare the two
selected directories without leaving them.
A: Read the "Macro Substitution" subsection in mc manual page.

-- Andrew

[Mar 28, 2013] Re Creating Symlinks with defaul relative path

Am Freitag, den 28.09.2012, 15:37 +0200 schrieb Carsten Richter:
Hi there,
When I am creating Symlinks in MC (using Ctrl-x s) i am spending quite
some time for replacing the absolute by the relative one and I was
wondering if it is possible to have the default path in the address line
to be the relative one.
Is there such an option or can it be implemented?
I think Ctrl-x v does the job

polishlinux.org " Midnight Commander in Action

Hi,

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:
http://wiki.cdlinux.pl/images/0/08/Wiki_warpman_01_col.png
http://wiki.cdlinux.pl/images/9/9b/Wiki_warpman_06_col.png

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:

mcu.sh:
#!/bin/bash
xterm -bg darkgreen -cr yellow -fg white -sl 1500 -e mc

mcr.sh:
#!/bin/bash
sudo xterm -bg darkred -cr yellow -fg white -sl 1500 -e mc

Cheers,
P2O2

[Nov 14, 2012] M-! allows to execute arbitrary Unix command and see output in built-in viewer.

[Nov 13, 2012] Compensating for deficiencies of built-in search with panelize command

No ability to search for files belonging to certain data range in available in built-in search in mc, but because script panelize command is available Unix find can be used to compensate for this shortcoming.

[Nov 06, 2012] Windows XP+/32 bit native port of GNU Midnight Commander, based on the current 4.8.4 development stream.

Sourceforge.net

Windows XP+/32 bit native port of GNU Midnight Commander, based on the current 4.8.4 development stream.

Midnight Commander (also known as mc) is a free cross-platform orthodox file manager and a clone of Norton Commander.

Features include the ability work with common archive formats as if they were simply another directory, and to function as an FTP client. Midnight Commander also includes an builtin editor/viewer, features include syntax highlighting for many languages, macros, code snippets, simple integration with external tools, automatic indentation, mouse support, clipboard and the ability to work in both ASCII and hex modes.

Midnight Commander can also rename groups of files, move files to a different directory at the same time as it renames them. It lets the user specify the original and resulting file names using wildcard characters.

[Nov 06, 2012] Mc allows one panel to be full screen and the other half screen. In this case tab essentially expands the other panel to full screen

This is an interesting consequence of having wide mode and it is also present in FAR. I come across it quite accidentally testing mc for compatibility with OFM1999 standard.

[Nov 06, 2012] Diffs in color by James Ogley

openSUSE

Tip :

+ t r & ! t t
d       Diff against file of same name in other directory
        if [ "%d" = "%D" ]; then
          echo "The two directores must be different"
          exit 1
        fi
        if [ -f %D/%f ]; then        # if two of them, then
          diff -up %f %D/%f  sed -e 's/\(^-.*\)/\x1b[1;31m\1\x1b[0m/g' \
                                  -e 's/\(^\+.*\)/\x1b[1;32m\1\x1b[0m/g' \
                                  -e 's/\(^@.*\)/\x1b[36m\1\x1b[0m/g'  less -R
        else
          echo %f: No copy in %D/%f
        fi
D       Diff current directory against other directory
        if [ "%d" = "%D" ]; then
          echo "The two directores must be different"
          exit 1
        fi
        diff -up %d %D  sed -e 's/\(^-.*\)/\x1b[1;31m\1\x1b[0m/g' \
                             -e 's/\(^\+.*\)/\x1b[1;32m\1\x1b[0m/g' \
                             -e 's/\(^@.*\)/\x1b[36m\1\x1b[0m/g'  less -R
        fi

[Nov 05, 2012] NEWS-4.8.2 – Midnight Commander

Added new flag -X (--no-x11) to allow not to use X11 to get the state of modifiers Alt, Ctrl, Shift (#86)

[Nov 05, 2012] Mcedit allows to edit many files in one mcedit window 4.8.4 – Midnight Commander

  • Multieditor: allow edit many files in one mcedit window (#2261, #2839)

    It would be nice if editor could open several files simultaneously in one window. Window could be split up vertically or horizontally. And it would be perfect if one could use copy/move/paste functions (F5/F6) between these files without using intermediate clipboard file ~/.mc/mcedit/cooledit.clip

  • Aspell support for spell check (#2788)

[Nov 04, 2012] Multiple viewers and editors¶

Multi-screen feature: support of many opened editors and viewers (#1490)
You can concurrently run multiple viewers and editors (screens). Use following default hotkeys:
shortcut description
Meta + ` Show list of screens: viewers, editors and file panel
Meta + { Switch to previous screen
Meta + } Switch to next screen

[Oct 30, 2012] History of commands entered in command line is available by clicking [^] in the right corner with the mouse.

[Oct 29, 2012] Midnight Commander Development Revived - Slashdot

great for patch work (Score:5, Interesting)

by nevets (39138) writes: on Monday January 26 2009, @05:09PM (#26612777) Homepage Journal

I love mc!

I use it all the time for patch management. One little tidbit that most people do not know about mc is that you can cd into a patch. Edit the diffs in the patch, and copy a diff from one patch to another patch file, just like copying or moving a file.

Performing some operation on multiple files with the help of mc

Aye, that's a standard (and heavily used) feature here. it doesn't do much however for the "I want to run this command on some arbitrary selection of those files" case.

mc can be used then, even though the order of operations is slightly different:

1: mc
2a: select files
2b: type the command
3: hit ctrl-x t
then F10 if you don't want to use mc anymore...

it has the same effect as you describe, it's a little bit less effective as far as typing goes (but not much) - it shouldn't matter if you use it rarely, if you'd use it more often you would probably already
be in mc.

2a and 2b can be done in any order.

2a: there are several ways to select files you want to use:

insert tags/untags files
+ enables you to type in shell patter or regexp (configurable)
meta-? is a simple version of find+grep
ctrl-x ! let's you run any program that returns list of files (e.g.
find)

you do not have to use all the fancy file picking mechanizms, if you want to stay simple you can use insert and possibly +

3: you can edit the resulting command line before hitting enter (unfortunately not using your shell, it gets into shell history though).

you have to know the ctrl-x t spell though. then again, you have to know select if you want to use it so it's basically the same (and there's context sensitive help in mc when you forget the keybinding).

note that while what I describe is somewhat complicated you can use it in very simple form, in that case it's basically the same as select. the additional functionality does not stand in your way...

...
> Err, to repeat the point, I don't. File management is perhaps less
> than 3% of my time, if that.

what I was saying is that I am not all the way on the other side (as you suggested). In fact if it weren't for mc I would probably use file managers less than 10% (at least that was the case before I've found mc) and be quite happy.

...> > I don't get it. What is it that LIST does that mc does not?
>> Faster, smaller, lighter, more unobtrustive, easier/more-intuitive
> cross-directory operations, default/expected key bindings, less
> cruft. I don't want a swiss army knife. I just want a small fruit
> knife.

smaller: yes (but who cares?)

faster: NO, see the timing of startup/exit below, and there doesn't seem to be any detectable speed difference during operation.

more unobtrusive: mc even let's you work in your shell, how can it be any less obtrusive? you can have nothing but panel on the screen...

intuitive: list is not intuitive at all, without using the help screen you wouldn't be able to do almost anything. 'c' does not copy. v is for NV (arc viewer) [linux version, IIRC it is somewhat better in DOS
version] etc. mc is not anymore intuitive than that but at least it is easy to get help, it displays basic keys on the screen (if you want it to) and lot of keys are the same as nc uses (which is/was sort of de
facto standard)

cross directory ops: linux list doesn't seem to have any. haven't find a way to copy a file (intuitive???). what I remember from dos version is that it brings up dialog where you can type in the destination, which is exactly what mc does. mc provides the oposite panel's directory as default but you can start typing your own destination right away so it doesn't slow you down at all, it even provides auto-completion (meta-tab).

key bindings: list definitely does NOT provide expected key bindings, specially the linux version. the dos version - perhaps and if you like those then that's a valid point against mc. still - you cannot change
them so how is it that you know what to expect when you hit r? is it remove or rename? intuitive?

the knife analogy is not a valid one in this case. the extra functionality of mc does not come at significant cost - the only difference is that the program is bigger, it does not have almost any
difference on start-up time (that's the only possible difference). the HD space it takes up is not of concern (today and even less concern in the future). How is the extra functionality of mc standing in your way? If you don't know about the extra keybindings you simply don't use them.
What's the problem?

...
> >> mc enforces a UI which I find nearly unusable and supports a raft
> >> of features that I find distracting from what I'm
>> > ? every UI program enforces its UI. every CLI program enforces
> > its UI as well. LIST does. not sure why you are singling mc out.
>> Because I don't like mc's choices?

in one panel configuration it is basically the same as list...

...
> Silly examples: The may MC handles cross-directory operations is the
> exact opposite of what I prefer. mc requires the other pane to be
> on the target and the current pane to be the source. Aaaargh! That

(sort of repeated from above) no it does not. it just provides it as
default, you can immediately type in your own destination just as if the
default wasn't there. it even provides auto-completion. what more (or
less) do you want? how is list better than that?

> catches me almost every time. The second confirm/edit/etc step
> under mc when doing a tagged file operation is something I've never
> wanted (or used) and would really like to never see.

you get the same dialog in list. how else would you specify the
destination? it does not make any sense. what do you mean?

> ObNote: I'd also much prefer it if mc left me in the directory it
> was viewing when I exited, rather than the directory I started it
> from.

list or any other program does not do that either. and cannot. that's
why cd is internal shell command (child cannot change the parent process
environment, cwd etc.)

however, there's a sort of solution for this, here's a relevant quote
from man page:

-P At program end, the Midnight Commander will print
the last working directory. This function should
not be used directly, instead, it should be used
from a special shell function that will automati­
cally change the current directory of the shell to
the last directory the Midnight Commander was in
(thanks to Torben Fjerdingstad and Sergey for con­
tributing this function and the code implementing
this option). Source the files
/usr/lib/mc/bin/mc.sh (bash and zsh users) respec­
tively /usr/lib/mc/bin/mc.csh (tcsh users) in order
to have this function defined.


> > you can fire it off anytime you want and quit it with single
> > keystroke, it's not a monster that would take forever to start up:
>> Arguably that's little different from list.
>> > jojda:~>time mc
>> $ time mc
> real 0m0.469s
> user 0m0.000s
> sys 0m0.040s
>> $ time list
> real 0m0.098s
> user 0m0.070s
> sys 0m0.020s

jojda:~/skusobna/list>time ./list
0.010u 0.000s 0:00.10 10.0% 0+0k 0+0io 217pf+0w
jojda:~/skusobna/list>time mc

0.020u 0.000s 0:00.10 20.0% 0+0k 0+0io 388pf+0w
jojda:~/skusobna/list>

I compiled the list (crowe's version for linux) and above are the
results on my machine. I would say that you cannot distinguish between
list and mc (as far as start-up time goes). Not sure how to measure
anything else but from visually judging the speed I don't think there's
any significant difference.

btw on your computer it says that real time was 0.469s while the sum
of other times was a lot less - that means that there was something else
going on on the system. Or perhaps it was waiting for a disk to load the
file (mc itself, that would mean that you'd have to wait for about .5s
when you start mc first time/after a very long time - that's not such a
big deal). Since I already ran mc I obviously cannot test the first
start right now...

> No promises on not having a slow finger, tho I tried not to.
>> > you can even run it with command line, it's not some internal
> > funky CLI, it's your login shell, basically unchanged, you just
> > hit ctrl-o to make panels disappear (but you _don't_ _have_ to use
> > this feature, you can just quit mc or use ctrl-z)
>> I like the bash command line and want it to be my default CLI UI.

good. as far as comparison between list and mc goes: mc is basically
the same but provides you with you shell even from within mc (and yes,
it's bash shell (or whatever your login shell is), not some internal
funky shell).

> Nothing else, just bash as configured by my .bashrc, under an xterm
> as configured (and keys re-bound) as per my .Xdefaults. I like
> that and would like to stay with it, augmenting it only in the areas
> mentioned, not replacing or changing large chunks of it.

OK. that's what I do as well. whether you augment it using list or
using mc there's no difference in obtrusiveness, I would argue that mc
is less obtrusive because it lets you use you shell even when you run mc
(again, this functionality does not come at a price - if you don't want
it just don't use it, it does not prevent you from using ctrl-z or quite
mc etc.).

> > also: menu bar, command line, status line, hint line can all be
> > turned off so you're left with panel(s) only.
>> I'd rather (almost always) have visible the bottom end of scrollback
> (usually the last 20 or 100 lines depending on window size, with a
> further 5K lines available under PgUp/PgDn)). That I find useful
> and use dozens of times a day. The vast majority of the time I
> don't have a use for the panes.

so at those time do not run the file manager or use ctrl-o with mc (or
ctrl-z), that's what I do as well. have an xterm, sometime run mc in it,
depending on what I do. when I want to use command line again (in the
same xterm) I either quit mc or use ctrl-o (depending on what I think I
will be doing).

ctrl-o has an advantage of keeping the directories of shell and mc in
synch - if you are in mc and change directory the shell's cwd changes as
well, if you hit ctrl-o and cd in shell the mc's cwd changes too (that
wouldn't happen if you used ctrl-z). again: you do not have to use this
feature and it doesn't cost you anything... IMO it makes perfect sense,
specially for people who do significant amount of work using command
line but that's just me - you might not find it useful and you do not
have to use it (or even know about it). it's not forced on you.

> > mc is not an integrated solution.
>> We disagree.

how is mc more integrated solution than list? you can use it in the
same way that you use list (in principle, it's, of course, not exactly
the same).

> Stylistically I'd prefer something that handled mail far closer to
> the way MH approaches handling mail than the way that any of the
> mbox-based tools do.

what is this about? and BTW as far as email goes the best way to store
it is to use IMAP (which IIRC is what you do, or at least advocate).

> >> Hurm. John Crowe's list (OSS) seems a fairly good starting
> >> point. Its got most of the basic supports there already. I
> >> really should take some time off and just hack it into shape.
>> > he recommends mc as well:-) just checked the web page.
>> Yeah, I know.
>> > the more you're explaining the more I find your position strange.
> > everything that you write (apart from keybindings configuration)
> > points to mc. yet you don't like it. is it something personal?
>> Nope, just what I've written.

but based on what you've written you want mc! (overall, apart from the
keybindings) I am quite confused - what you're saying about how you work
makes sense (I work in similar way even though not on the same kind of
tasks) but when it comes to mc you're suddenly strange... well, one way
or another, I guess that's it from me, I hope you didn't find it too
pushy... (=unless you want to continue discussion I am not goin to
continue with my mc evangelism).

erik

[Oct 19, 2012] mc 4.8.1.3 correctly implements command window making it probably the first Unix OFM really helpful for Unix sysadmins

You are great guys !!!

My sincere congratulations to the development team

Name Nickname Country Additional info
Andrew Borodin andrew_b Russia aborodin at vmail dot ru
Stan. S. Krupoderov iNode Russia pashelper at gmail dot com
Ilia Maslakov angel_il Russia (il.smind at gmail dot com)
Sergei Trofimovich slyfox,sjøtroll,skogtroll Belarus
Slava Zanko slavaz, slavazanko Belarus (jabber+gmail: slavazanko at gmail dot com)
Yury V. Zaytsev ZYV Germany

[Oct 18, 2012] Midnight Commander tips

openSUSE

Using the mouse

Although Midnight Commander is a text mode application it can make use of mouse. The openSUSE delivered mc will make use of the mouse when used with a GUI console, without any further configuration needed.

The text mode terminal that we get when booting in runlevels 2 or 3 is a bit different story. You have to install the package gpm ("general purpose mouse") which is also called mouse server. The gpm is used in Linux to receive movements and clicks from mouse. Start gpm and then start Midnight commander.

If you come to the text terminal using Ctrl + Alt + F1, then gpm will not work as another driver that belongs to GUI (X Server) claims control over the mouse.

Lynx like motion

This is browsing using the cursor keys. You have never seen graphical applications (like Konqueror) run this fast through directories.

openSUSE 11.4 and later

Main difference to older versions of Midnight Commander is different menu, so now we need Panel options instead of Configuration.

To enable it

  1. Press F9 to select drop down menus on the top of the screen.
  2. Press Alt + o or move highlight with cursor keys for left or right to the Options, then press arrow down, to get drop down menu with options.
  3. Press arrow down to select Panel options and Enter key to open window with setup
  4. Press arrow down until you have selected [ ] Lynx-like motion, or , or ALT + y to jump directly.
  5. Press Space to check option. It will show [x] Lynx-like motion if it is active (enabled)
  6. Press Alt + s or move highlight to the [ Save ] and press Enter to save setting.

openSUSE 11.3 and earlier

To enable it

  1. Press F9 to select drop down menus on the top of the screen.
  2. Press Alt + o or move highlight with cursor keys for left or right to the Options, then press arrow down, to get drop down menu with options.
  3. Press Alt + c or Enter to get dialog window Configuration with options.
  4. Now don't use key shortcut, but use cursor key to move highlight to [ ] Lynx-like motion option,
  5. Press Space to check option. It will show [x] Lynx-like motion if it is active (enabled)
  6. Press Alt + s or move highlight to the [ Save ] and press Enter to save setting.

FTP browsing

This is file browsing on remote FTP server just as it is on your computer.

  1. Press F9 to select drop down menus on the top of the screen.
  2. Press Alt + L if you want to use left side panel, or Alt + R for right panel.
  3. Press Alt + P for input box where you have enter server name. Enter for instance
ftp.gwdg.de/pub

and press Enter.

Now mc will try anonymous connection to remote machine. If machine responds, you'll get directory listing of /pub on remote server.

It is possible to do the same from mc command line by typing:

cd /#ftp:ftp.gwdg.de/pub  

Archive browsing

Archive in classic meaning is compressed file. In Linux you can recognize them by suffix like:

tgz, tar.gz, tbz, tar.bz2

and many more, but above few are the most used

  1. Highlight the file
  2. Press Enter

That's it. Midnight Commander will decompress file for you and present it's internal structure like any other directory. If you want to extract one or all files from archive mark what you want toextract and use F5 to copy in another panel. Done.

RPM browsing

The package installation files for any SUSE are RPM and mc will let you browse them.

  1. Highlight the file
  2. Press Enter

You'll see few files:

/INFO
CONTENTS.cpio
HEADER
*INSTALL
*UPGRADE

Browse to see details of your RPM.

The CONTENTS.cpio is actual archive with files, and if you want to see within:

  1. Highlight the file
  2. Press Enter

(You know the drill)

The *INSTALL and *UPGRADE will do what the name tells, but if you want only to extract one or more files from CONTENTS.cpio than use F5 to copy them in the directory in the other panel.

PuTTY and line drawing

PuTTY is terminal application used to access remote computers running Linux via ssh (SSH tunnels from Microsoft Windows see details). The line drawing in Midnight Commander, YaST and another applications that draw lines using special characters can be displayed wrong as something else. The solution is to change settings:

  • menu: Window > Translation:
    • Received data assumed to be in which character set: UTF-8
    • Handling of line drawing characters: Use Unicode for line drawing

If that doesn't help, you may set this too:

  • menu: Connection > Connection-type string: linux
  • menu: Terminal > Keyboard > The Function keys and keypad: Linux

Found on webmilhouse.com.

User menu (F2 key) add-on

Diffs in color

Tip by James Ogley:

+ t r & ! t t
d       Diff against file of same name in other directory
        if [ "%d" = "%D" ]; then
          echo "The two directores must be different"
          exit 1
        fi
        if [ -f %D/%f ]; then        # if two of them, then
          diff -up %f %D/%f  sed -e 's/\(^-.*\)/\x1b[1;31m\1\x1b[0m/g' \
                                  -e 's/\(^\+.*\)/\x1b[1;32m\1\x1b[0m/g' \
                                  -e 's/\(^@.*\)/\x1b[36m\1\x1b[0m/g'  less -R
        else
          echo %f: No copy in %D/%f
        fi
D       Diff current directory against other directory
        if [ "%d" = "%D" ]; then
          echo "The two directores must be different"
          exit 1
        fi
        diff -up %d %D  sed -e 's/\(^-.*\)/\x1b[1;31m\1\x1b[0m/g' \
                             -e 's/\(^\+.*\)/\x1b[1;32m\1\x1b[0m/g' \
                             -e 's/\(^@.*\)/\x1b[36m\1\x1b[0m/g'  less -R
        fi

[Sep 28, 2012] Midnight Commander Guide

Everything is nice but implementation of third (command line) window remains completely screwed in Midnight Commander. This is the key OFM feature that Miguel de Icara never understood and we are still paying for that.
mailinglists@nawaz.org

I've written a guide to Midnight Commander in presentation format: http://nawaz.org/media/docs/mc/mc.pdf

For those who really don't want to look at the PDF and are just curious about the content, I put the HTML version here: http://www.nawaz.org/media/docs/mc/mc.html

It'll have a bunch of LaTeX formatting interspersed with the text, but much of it should be readable.

-- Be careful about reading health books. You may die of a misprint. - Mark Twain

Guus Bonnema:

Man, this rocks! Excellent job. Many problems and solutions discussed plus a lot of tips. And I like the presentation. I am proud to see LaTeX still leads to beautiful products.

Natalie

...Maybe you could add that the copy and move dialogs (F5 and F6) have a very useful history. With Alt-H you get a list of dirs that you have used earlier to copy or move to. Clicking with the mouse on the [^] at the end of the input line has the same effect.

xxx

Carsten Richter wrote:

> Nice work, there are some key bindings which don't work here, maybe due to my
> terminal emulator (such as Alt-'). But for sure Ctrl-I doesn't redraw
> the display wenn it's messed up. I need to do the Ctrl-o twice.

It's Alt-` (backtick) and Ctrl-l (lowercase L). That should work.

xxx

Carsten Richter writes:

there are some key bindings which don't work here, maybe due to my terminal emulator (such as Alt-'). But for sure Ctrl-I doesn't redraw

As someone pointed out, it's a backtick and Ctrl-L. I'll see if I can conveniently change the font where those key bindings are listed...

the display wenn it's messed up. I need to do the Ctrl-O twice.

Ctrl-L is somewhat common and good to remember. I think a bunch of other Linux programs use it.

I also would like to know how to change the default keybindings. I was able to change the autocompletion keybinding in an old mc using the "learn keys" option. But with never ones it's not working apparently.

I'm pretty sure there's a way - you'll find it in the release notes for some release in the last 2-3 years. I think I once found some places that describe how to change them, but it seemed quite painful. I only really wanted it to be able to sort files rather than having to go to the menu - but then they allowed sorting by clicking the headers, and that sufficed.

-- Heard the one about the dyslexic devil worshiper? He sold his soul to Santa.

Hallo, mailinglists:

there are some key bindings which don't work here, maybe due to my terminal emulator (such as Alt-?). But for sure Ctrl-I doesn't redraw

As someone pointed out, it's a backtick and Ctrl-l. I'll see if I can conveniently change the font where those key bindings are listed...

Helmut:

Just additional: sometimes (especially with some remote terminals) the function keys don't work. But (p.e.) esc 3 instead of f3seems still to work.

[Sep 21, 2010] Pseudo-graphic border

Should be export LANG=C mc
gnome.apps.mc.general

> Please, a small question - I made the new installation (FC3, KDE)
> and run MC (the great SW!!). Everything works, except that borders on
> the panels are drawn by 'a umlaut' instead of pseudo-graphic (lines)

This is a locale and termcap issue which I do not fully understand.
Fortunately I do know a workaround. :) Use this:

LANG=C mc
to start mc.

Sergiy Grudskiy

So far I've been able to change the color of text, but not the default, blue background.
jayeola@tp20$ mc -V

GNU Midnight Commander 4.6.1a
Virtual File System: tarfs, extfs, cpiofs, ftpfs, fish, smbfs, undelfs
With builtin Editor
Using system-installed S-Lang library with terminfo database
With subshell support as default
With support for background operations
With mouse support on xterm
With internationalization support
With multiple codepages support
Data types: char 8 int 32 long 32 void * 32 off_t 64 ecs_char 8

in xterm i put this line into ~/.Xresources

===========================
XTerm*color4: rgb:0/5/D
===========================

u can use from 0/0/0 to F/F/F afaik, then restart X

On Friday 25 February 2005 07:49, Duane Frederici wrote:
I'm running SuSe 9.0 and when I exit MC with F10.....I return to my home directory. Under Red Hat
when I exit MC with F10 it is the last directory I was in, in MC......can I make MC under SuSe 9.0
behave the same way and if so how?
I do not want to return to my user home directory when exiting MC....I want to stay in that current directory.
MC is at level 4.6.0
Thanks for the help, 
> MC......can I make MC under SuSe 9.0 behave the same way
Yes.
> and if so how?
"mc" is probably a shell alias:
$ alias mc
alias mc='. /usr/share/mc/bin/mc- per.sh'
(This is bash in Slackware.)
Simply set the alias in your shell. You probably have the mc- per.sh
script there somewhere; if not, just copy it from the RH box.
On Thursday 03 March 2005 07:14, leonp@plris.com wrote:
>  Please, a small question - I made the new installation (FC3, KDE)
> and run MC (the great SW!!). Everything works, except that borders on
> the panels are drawn by 'a umlaut' instead of pseudo-graphic (lines)
This is a locale and termcap issue which I do not fully understand.
Fortunately I do know a workaround.  :)  Use this:
    LANG=C mc
to start mc.

Way to make F6 put the current name on the input line for editing (renaming)

Q: [Felix Miata]:

Surely there must be some way to make F6 put the current name on the
input line for editing (renaming) instead of moving to some other
location, but I am at a loss to find it. I'm really tired of retyping
complete filenames. Someone please tell me how to easily just add or
deleting one character in a filename.
A[Pavel Roskin]: Shift-F16 (in the latest versions). Also, file completion (Escape-Tab) works in the rename dialog, which makes it easy to rename to any exisitng filename.
Pavel Roskin wrote:
>
> On Fri, 2005-03-04 at 14:53 -0500, Felix Miata wrote:
> > Surely there must be some way to make F6 put the current name on the
> > input line for editing (renaming) instead of moving to some other
> > location, but I am at a loss to find it. I'm really tired of retyping
> > complete filenames. Someone please tell me how to easily just add or
> > deleting one character in a filename.
>
> Shift-F16 (in the latest versions).
I don't have any F16 key.  :-P  F6 tries to move. Shift-F6 doesn't do
anything at all where most needed, on tty[1-6].
> Also, file completion (Escape-Tab) works in the rename dialog, which
> makes it easy to rename to any exisitng filename.
This is unintuitive and doesn't seem to work right. When I try esc-tab,
it brings up a list of local files. If I pick one, it pastes it in front
of the proposed path to move to that came up with F6.
-- "In everything, do to others what you would have them do to you." Matthew 7:12 NIV

/etc/mc/mc.ext file are some entries for common file types.

Date: Sun, 19 Dec 2004 22:30:03 +0100
From: Frank Dietrich
Subject: Re: ENTER key behavior
In--to: <200412180945.iBI9jhSn064731@fe08.axelero.hu>
Sender: mc-bounces@gnome.org
To: mc@gnome.org
Errors-to: mc-bounces@gnome.org
Original-recipient: rfc822;speditor@optonline.net
Hi Andras,
"Andras Varga" wrote:
> Almost, but not really. I expect MC to launch the program which is
> registered for that file in the KDE (or GNOME) mime database. Why
> should I have to duplicate that information manually in MC...?
No. You don't have realy to duplicate it.
In the /etc/mc/mc.ext file are some entries for common file types.
e.g. PDF
-----------------------------------------------
# PDF
type/^PDF
    Open=run-mailcap application/pdf:%f &
-----------------------------------------------
This entry start your default application for this mime type.
> In Windows, the feature works like this: it uses the "start" command
> (of cmd.exe) which "opens" the file (or folder) as if I'd
> double-clicked it in the Explorer.
'start' does the same thing under Windows as run-mailcap will do under
Linux.
> OFF: Also a good thing in Windows is that "start ." (or "start
> any-directory") opens the folder in Explorer. I also miss that on
> KDE, where I have to type "konqueror ." (or is there a "start"
> equivalent)?
Do you wan't to have only one command to do all the above magically
for you? Write your own. ;-)
Create an script named 'start', place it in a dir in your binary
search path and make it executeable.
--- start ------------------------------------
#!/bin/sh
if test -d "$1"
then
  nautilus "$1"
else if test -e "$1"
  then
    run-mailcap "$1"
  else
    echo "Can't find directory or file: '$1'"
  fi
fi
-----------------------------------------------
Nautlius is a Gnome filemanager. I don't know what you should use
under KDE. May be konqueror will do the same.
start .              - opens nautilus in the current dir
start /var/log       - opens nautilus in the /var/log dir
start /docs/test.pdf - opens the test.pdf in the dir /doc
                       with the default mime application
                       for PDF documents
regards
Frank
_______________________________________________
Mc mailing list
http://mail.gnome.org/mailman/listinfo/mc

Google matched content

Softpanorama Recommended

[May 10, 2021] The Tilde Text Editor Published on May 10, 2021 os.ghalkes.nl

Internal

External

YouTube

Cooledit

Groups

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 quotes : Somerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose Bierce : Bernard 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 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

Classic books:

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 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-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) 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 to buy a cup of coffee for authors of this site

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 Softpanorama society. 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: April 05, 2020


[ comments ]


Older Post Newer Post