MC(1)
๐ MC(1) โ GNU Midnight Commander ๐
okay so bestie, welcome to the Midnight Commander manual page, this is the GNU Midnight Commander one, section 1 of the manual, and honestly? it's giving iconic file manager energy. buckle up, we're gonna read the whole thing together ๐ซถ
โจ NAME โจ
mc โ Visual shell for Unix-like systems.
๐ SYNOPSIS ๐
mc [-abcCdfhPstuUVx] [-l log] [dir1 [dir2]] [-e [file] ...] [-v file]
๐ฆ DESCRIPTION ๐ฆ
GNU Midnight Commander is a directory browser / file manager for Unix-like operating systems. that's it, that's the vibe, she browses directories and manages files and she does it beautifully ๐
๐ OPTIONS ๐
okay here come the flags, and there are a lot of them, so no skimming bestie, every single one matters:
-a,--stickcharsโ turns OFF using graphic characters for drawing lines. so if your terminal is doing the most with box-drawing characters, this is your girl.-b,--nocolorโ force black and white display. monochrome era, minimalism, we respect it.-c,--colorโ force color mode ON. pls check the Colors section for more info, iykyk.-C arg,--colors=argโ specify a different color set right there on the command line. the format ofargis documented in the Colors section.--configure-optionsโ display configure options. just shows you the tea.-d,--nomouseโ disable mouse support. touchpad girlies this one's for you.-e [file],--edit[=file]โ start the internal editor. if a file is specified, it opens it on startup. see alsomcedit(1).-f,--datadirโ display the compiled-in search paths for Midnight Commander files. where does she live? now you know.-F,--datadir-infoโ display extended info about the compiled-in paths for Midnight Commander. the deluxe version of the above, literally.-g,--oldmouseโ force a"normal tracking"mouse mode. used when running on xterm-capable terminals (tmux/screen).-k,--resetsoftโ reset softkeys back to their default from the termcap/terminfo database. only useful on HP terminals when the function keys just... don't work ๐ญ-K file,--keymap=fileโ specify the name of a keymap file on the command line.-l file,--ftplog=fileโ save the ftpfs dialog with the server intofile.--nokeymapโ don't load key bindings from ANY file, just use the default hardcoded keys. raw. unfiltered. default.-P file,--printwd=fileโ print the last working directory to the specified file. โ ๏ธ this option is not meant to be used directly, okay? instead, it's used from a special shell script that automatically changes the current directory of the shell to the last directory Midnight Commander was in. source the file/usr/lib/mc/mc.sh(bash and zsh girlies) or/usr/lib/mc.csh(tcsh girlies) respectively, to definemcas an alias to the appropriate shell script.-s,--slowโ turn on slow terminal mode. in this mode the program won't draw expensive line drawing characters and will toggle verbose mode off. slow and steady, bestie ๐ข-S arg,--skin=argโ specify the name of a skin on the command line. the technology of skins is documented in the Skins section. glow up time โจ-t,--termcapโ used only if the code was compiled with S-Lang and terminfo: it makes Midnight Commander use the value of theTERMCAPvariable for the terminal information instead of the info on the system-wide terminal database.-u,--nosubshellโ disable use of the concurrent shell (only makes sense if Midnight Commander has been built with concurrent shell support).-U,--subshellโ enable use of the concurrent shell support (only makes sense if Midnight Commander was built with the subshell support set as an optional feature).-v file,--view=fileโ start the internal viewer to view the specified file. see alsomcview(1).-V,--versionโ display the version of the program. classic.-x,--xtermโ force xterm mode. used when running on xterm-capable terminals (two screen modes, and able to send mouse escape sequences).-X,--no-x11โ do not use X11 to get the state of the modifiers Alt, Ctrl, Shift.
and now, the paths tea, because how you call her changes everything:
If both paths are specified, the first path name is the directory to show in the active panel; the second path name is the directory to be shown in the other panel.
If one path is specified, the path name is the directory to show in the active panel; the value of "other_dir" from panels.ini is the directory to be shown in the passive panel.
If no paths are specified, the current directory is shown in the active panel; the value of "other_dir" from panels.ini is the directory to be shown in the passive panel.
๐ธ Overview ๐ธ
The screen of Midnight Commander is divided into four parts. Almost all of the screen space is taken up by two directory panels. By default, the second line from the bottom of the screen is the shell command line, and the bottom line shows the function key labels. The topmost line is the menu bar line. The menu bar line may not be visible, but it appears if you click the topmost line with the mouse or press the F9 key.
Midnight Commander provides a view of two directories at the same time. One of the panels is the current panel (a selection bar is in the current panel). Almost all operations take place on the current panel. Some file operations like Rename and Copy by default use the directory of the unselected panel as a destination (don't worry bestie, they always ask you for confirmation first ๐ซถ). For more information, see the sections on the Directory Panels, the Left and Right Menus and the File Menu.
You can execute system commands from Midnight Commander by simply typing them. Everything you type will appear on the shell command line, and when you press Enter, Midnight Commander will execute the command line you typed; read the Shell Command Line and Input Line Keys sections to learn more about the command line. main character energy honestly.
๐ญ Mouse Support ๐ญ
Midnight Commander comes with mouse support. It is activated whenever you are running on an xterm(1) terminal (it even works if you take a telnet, ssh or rlogin connection to another machine from the xterm) or if you are running on a Linux console and have the gpm mouse server running.
When you left click on a file in the directory panels, that file is selected; if you click with the right button, the file is marked (or unmarked, depending on the previous state). toggle toggle ๐
Double-clicking on a file will try to execute the command if it is an executable program; and if the extension file has a program specified for the file's extension, the specified program is executed.
Also, it is possible to execute the commands assigned to the function key labels by clicking on them.
The default auto repeat rate for the mouse buttons is 400 milliseconds. This may be changed to other values by editing the ~/.config/mc/ini file and changing the mouse_repeat_rate parameter.
If you are running Midnight Commander with the mouse support, you can get the default mouse behavior (cutting and pasting text) by holding down the Shift key.
โจ๏ธ Keys โจ๏ธ
Some commands in Midnight Commander involve the use of the Control (sometimes labeled CTRL or CTL) and the Meta (sometimes labeled ALT or even Compose) keys. In this manual we will use the following abbreviations:
C-<chr>โ means hold the Control key while typing the character <chr>. ThusC-fwould be: hold the Control key and typef.Alt-<chr>โ means hold the Meta or Alt key down while typing <chr>. If there is no Meta or Alt key, typeEsc, release it, then type the character <chr>.S-<chr>โ means hold the Shift key down while typing <chr>.
All input lines in Midnight Commander use an approximation to the GNU Emacs editor's key bindings (default).
You may redefine key bindings. See redefine hotkey bindings
for more info. All other key bindings (described in this manual) are relative to default behavior.
There are many sections which tell about the keys. The following are the most important.
- The File Menu section documents the keyboard shortcuts for the commands appearing in the File menu. This section includes the function keys. Most of these commands perform some action, usually on the selected file or the tagged files.
- The Directory Panels section documents the keys which select a file or tag files as a target for a later action (the action is usually one from the file menu).
- The Shell Command Line section lists the keys which are used for entering and editing command lines. Most of these copy file names and such from the directory panels to the command line (to avoid excessive typing) or access the command line history.
- Input Line Keys are used for editing input lines. This means both the command line and the input lines in the query dialogs.
๐ง Redefine hotkey bindings ๐ง
Hotkey bindings may be read from an external file (keymap-file). Initially, Midnight Commander creates key bindings using the keymap defined in the source code. Then, two files /usr/share/mc/mc.keymap and /etc/mc/mc.keymap are loaded always, sequentially reassigned to key bindings defined earlier. User-defined keymap-file is searched using the following algorithm (to the first one found):
- command line option
-K <keymap>or--keymap=<keymap> - Environment variable
MC_KEYMAP - Parameter
keymapin section[Midnight-Commander]of the config file. - File
~/.config/mc/mc.keymap
Command line option, environment variable and parameter in config file may contain the absolute path to the keymap-file (with the extension .keymap or without it). Search of keymap-file will occur in (to the first one found):
~/.config/mc/etc/mc//usr/share/mc/
๐ MISCELLANEOUS KEYS ๐
okay bestie these are the keys that didn't fit in any other lil category, they're just vibing here on their own ๐
Enterโ if there's literally any text sitting in the command line (yep, the one at the bottom of the panels), then that command gets executed, periodt. But if the command line is empty, then it depends: if the selection bar is chillin' over a directory, Midnight Commander does achdir(2)to that selected directory and reloads all the panel info. If the selection is an executable file, it just runs it. And finally, if the extension of the selected file name matches one of the extensions in the extensions file, then the corresponding command gets executed. three whole behaviours in one key, iconic honestly ๐C-lโ repaint all the information in Midnight Commander. a little glow-up for your screen โจC-x cโ run the Chmod command on a file or on the tagged files. ๐C-x oโ run the Chown command on the current file or on the tagged files.C-x lโ run the hard link command.C-x sโ run the absolute symbolic link command.C-x vโ run the relative symbolic link command. peep the File Menu section for more tea about symbolic links ๐ซC-x iโ set the other panel display mode to information.C-x qโ set the other panel display mode to quick view.C-x !โ execute the External panelize command.C-x hโ run the add directory to hotlist command.Alt-!โ executes the Filtered view command, which is described over in the view command.Alt-?โ executes the Find file command.Alt-cโ pops up the quick cd dialog. ๐งC-oโ when the program is being run in the Linux or FreeBSD console or under anxterm, it will show you the output of the previous command. And when it's running on the Linux console, Midnight Commander uses an external program (cons.saver) to handle saving and restoring of information on the screen.
When the subshell support is compiled in, you can type C-o at any time and you'll be taken right back to Midnight Commander's main screen โ and to return to your application you just type C-o again. ๐ฆ
but listen: if you've got an application suspended by using this trick, you won't be able to execute other programs from Midnight Commander until you terminate that suspended application. no cap, that's just how it is ๐ญ
๐ธ DIRECTORY PANELS ๐ธ
this section is all about the keys that operate on the directory panels. if you wanna know how to change how the panels look, go check the section on Left and Right Menus, bestie ๐
Tab,C-iโ change the current panel. The old other panel becomes the new current panel, and the old current panel becomes the new other panel. The selection bar moves from the old current panel to the new current panel. a lil switcheroo ๐Insert,C-tโ to tag files you may use theInsertkey (thekich1terminfo sequence). To untag files, just retag a tagged file. yes bestie, retagging is the untagging โจAlt-eโ to change charset of panel you may useAlt-e(M-e). Recoding is made from selected codepage into system codepage. To cancel the recoding, select"No translation"in the dialog of encodings.Alt-g,Alt-r,Alt-jโ used to select the top file in a panel, the middle file and the bottom one, respectively.Alt-tโ toggle the current display listing to show the next display listing format. With this it's possible to quickly switch to brief listing, long listing, user defined listing format, and back to the default. ๐C-\(control-backslash) โ show the directory hotlist and change to the selected directory.+(plus) โ this is used to select (tag) a group of files. Midnight Commander will prompt for a selection options. When Files only checkbox is on, only files will be selected. If Files only is off, as files as directories will be selected. When Shell Patterns checkbox is on, the regular expression is much like the filename globbing in the shell (*standing for zero or more characters and?standing for one character). If Shell Patterns is off, then the tagging of files is done with normal regular expressions (seeed (1)). When Case sensitive checkbox is on, the selection will be case sensitive characters. If Case sensitive is off, the case will be ignored. so many checkboxes omg ๐\(backslash) โ use the"\"key to unselect a group of files. This is the opposite of the Plus key.up-key,C-pโ move the selection bar to the previous entry in the panel.down-key,C-nโ move the selection bar to the next entry in the panel.home,a1,Alt-<โ move the selection bar to the first entry in the panel.end,c1,Alt->โ move the selection bar to the last entry in the panel.next-page,C-vโ move the selection bar one page down.prev-page,Alt-vโ move the selection bar one page up.Alt-oโ If the currently selected file is a directory, load that directory on the other panel and moves 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.Alt-iโ make the current directory of the current panel also the current directory of the other panel. Put the other panel to the listing mode if needed. If the current panel is panelized, the other panel doesn't become panelized. (important lil exception, don't forget it ๐)C-PageUp,C-PageDownโ only when supported by the terminal: change to".."and to the currently selected directory respectively.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-S-h,Alt-Hโ displays the directory history, equivalent to depressing the'v'with the mouse.
โจ QUICK SEARCH โจ
The Quick search mode allows you to perform fast file search in file panel. Press C-s or Alt-s to start a filename search in the directory listing. ๐
When the search is active, the user input will be added to the search string instead of the command line. If the Show mini-status option is enabled the search string is shown on the mini-status line. When typing, the selection bar will move to the next file starting with the typed letters. The Backspace or DEL keys can be used to correct typing mistakes. If C-s is pressed again, the next match is searched for.
If quick search is started with double pressing of C-s, the previous quick search pattern will be used for current search. double tap energy fr fr โจ
Besides the filename characters, you can also use wildcard characters '*' and '?'.
๐ SHELL COMMAND LINE ๐
This section lists keys which are useful to avoid excessive typing when entering shell commands. aka: your fingers will thank you ๐
Alt-Enterโ copy the currently selected file name to the command line.C-Enterโ same aAlt-Enter. May not work on remote systems and some terminals.C-S-Enterโ copy the full path name of the currently selected file to the command line. May not work on remote systems and some terminals.Alt-Tabโ does the filename, command, variable, username and hostname completion for you. the way it just knows what you meant ๐ญ๐C-x t,C-x C-tโ copy the tagged files (or if there are no tagged files, the selected file) of the current panel (C-x t) or of the other panel (C-x C-t) to the command line.C-x p,C-x C-pโ the first key sequence copies the current path name to the command line, and the second one copies the unselected panel's path name to the command line.C-qโ the quote command can be used to insert characters that are otherwise interpreted by Midnight Commander (like the'+'symbol). so you can sneak in a+without it doing a whole thing ๐Alt-p,Alt-nโ use these keys to browse through the command history.Alt-ptakes you to the last entry,Alt-ntakes you to the next one.Alt-hโ displays the history for the current input line.
๐ฆ GENERAL MOVEMENT KEYS ๐ฆ
The help viewer, the file viewer and the directory tree use common code to handle moving. Therefore they accept exactly the same keys. Each of them also accepts some keys of its own. ๐ง
Other parts of Midnight Commander use some of the same movement keys, so this section may be of use for those parts too. (multipurpose section, we love her ๐)
Up,C-pโ moves one line backward.Down,C-nโ moves one line forward.Prev Page,Page Up,Alt-vโ moves one page up.Next Page,Page Down,C-vโ moves one page down.Home,A1โ moves to the beginning.End,C1โ move to the end.
The help viewer and the file viewer accept the following keys in addition to the ones mentioned above:
b,C-b,C-h,Backspace,Deleteโ moves one page up.Space barโ moves one page down.u,dโ moves one half of a page up or down.g,Gโ moves to the beginning or to the end.
๐ INPUT LINE KEYS ๐
The input lines (they are used for the command line and for the query dialogs in the program) accept these keys:
C-aโ puts the cursor at the beginning of line.C-eโ puts the cursor at the end of the line.C-b,move-leftโ move the cursor one position left.C-f,move-rightโ move the cursor one position right.Alt-fโ moves one word forward.Alt-bโ moves one word backward.C-h,Backspaceโ delete the previous character.C-d,Deleteโ delete the character in the point (over the cursor).C-@โ sets the mark for cutting.C-wโ copies the text between the cursor and the mark to a kill buffer and removes the text from the input line.Alt-wโ copies the text between the cursor and the mark to a kill buffer.C-yโ yanks back the contents of the kill buffer.C-kโ kills the text from the cursor to the end of the line.Alt-p,Alt-nโ Use these keys to browse through the command history.Alt-ptakes you to the last entry,Alt-ntakes you to the next one.Alt-C-h,Alt-Backspaceโ delete one word backward.Alt-Tabโ does the filename, command, variable, username and hostname completion for you.
๐ MENU BAR ๐
The menu bar pops up when you press F9 or click the mouse on the top row of the screen. The menu bar has five menus: "Left", "File", "Command", "Options" and "Right". five whole menus, we're spoiled honestly ๐
The Left and Right Menus allow you to modify the appearance of the left and right directory panels.
The File Menu lists the actions you can perform on the currently selected file or the tagged files.
The Command Menu lists the actions which are more general and bear no relation to the currently selected file or the tagged files.
The Options Menu lists the actions which allow you to customize Midnight Commander. โจ
๐ Left and Right (Above and Below) Menus
okay so real talk โ the whole look of your directory panels is yours to change, and you do it from the Left and Right menus. plot twist: if you chose the horizontal panel split over in the Layout options dialog, those same two menus get renamed to Above and Below. Same menus, cuter names, it's giving top/bottom energy. ๐ซถ
โจ Listing Format... โจ
The listing mode view is literally just the thing that shows you a list of files, and there are four different listing formats you can pick from: Full, Brief, Long and User. Choose your fighter. ๐
- Full โ the full directory view shows the file name, the size of the file, and the modification time. Classic, reliable, iconic.
- Brief โ shows only the file name, and it can run from 1 up to 9 columns, which means you see way more files than the other views. Density queen. ๐
- Long โ basically the output of the
ls -lcommand. It takes up the whole screen width, so bestie it is not subtle. - User โ if you pick this one, you have to specify the display format yourself. No format, no vibes, sorry. ๐
๐ Building your own User display format
So the user display format is a little build-your-own-sundae situation, and it has rules. Step one: it must start with a panel size specifier, and that's either:
halfโ a half screen panelfullโ a full screen panel
After the panel size, you can say how many listings to fit in the panel, side-by-side โ meaning how many times to repeat the fields horizontally. That defaults to 1, and you change it by adding a number from 1 to 9 to the format string. โจ
After that, you add the names of the fields, each with an optional size specifier. These are the fields you can display:
nameโ displays the file name.sizeโ displays the file size.bsizeโ an alternative form of the size format. It displays the size of the files, and for directories it just showsSUB-DIRorUP--DIR.typeโ displays a one character wide type field. This character is similar to whatlsshows with the-Fflag:*for executable files,/for directories,@for links,=for sockets,-for character devices,+for block devices,|for pipes,~for symbolic links to directories, and!for stale symlinks (links that point nowhere). Little character, big job. ๐ฆmarkโ an asterisk if the file is tagged, a space if it's not.mtimeโ file's last modification time.atimeโ file's last access time.ctimeโ file's status change time.permโ a string representing the current permission bits of the file.modeโ an octal value with the current permission bits of the file.nlinkโ the number of links to the file.ngidโ the GID (numeric).nuidโ the UID (numeric).ownerโ the owner of the file.groupโ the group of the file.inodeโ the inode of the file.
You can also use these keywords to define the panel layout:
spaceโ a space in the display format.|โ add a vertical line to the display format.
๐ง Size specifiers, iykyk
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. And here's the โจspicyโจ part: if that number is followed by the symbol +, then the size specifies the minimal field size โ so if the program figures out there's more space on the screen, it will then expand that field. Growth mindset, periodt.
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 | size:7 | type mode:3
๐ธ Other panel modes
Panels may also be set to the following modes:
- Info โ the info view displays information related to the currently selected file and, if possible, information about the current file system. Nosy in the best way. ๐
- Tree โ the tree view is quite similar to the directory tree feature. See the section about it for more information.
- Quick View โ in this mode, the panel switches to a reduced viewer that displays the contents of the currently selected file. And if you select the panel (with the tab key or the mouse), you get access to the usual viewer commands. Tiny preview, full power. ๐ฅ
๐ Sort Order... ๐
The eight sort orders are: by name, by extension, by modification time, by access time, and by inode information modification time, by size, by inode, and unsorted. Count 'em โ eight. ๐
In the Sort order dialog box you can choose the sort order, and you may also specify if you want to sort in reverse order by checking the reverse box. Flipping the whole thing upside down, iconic behavior.
By default directories are sorted before files, but this can be changed from the Panel options menu (the option Mix all files). Chaos mode is available, bestie, it's just opt-in. ๐
๐ Filter... ๐
The filter command lets you specify a shell pattern (for example *.tar.gz) which the files and directories must match to be shown. The input line lets you enter the pattern of file/directory names that will be shown in the panel. So you're basically telling the panel "only show me the ones that ate." โจ
And now the checkboxes, because they change everything:
- When the Files only checkbox is on, only files will be matched to the filter, and all directories will be shown. Otherwise, as files as directories will be filtered.
- When the Shell Patterns checkbox is on, the regular expression is much like the filename globbing in the shell (
*standing for zero or more characters and?standing for one character). Otherwise, the matching of files/directories is done with normal regular expressions (seeed(1)). - When the Case sensitive checkbox is on, the filtering will be case sensitive characters. Otherwise, the case will be ignored.
๐ Reread
The reread command reloads the list of files in the directory. It's useful if other processes have created or removed files โ basically it's the "bestie refresh, the group chat updated" button. ๐ซถ
๐ File Menu ๐
Midnight Commander uses the F1 - F10 keys as keyboard shortcuts for the commands sitting in the file menu. The escape sequences for the function keys are terminfo capabilities kf1 through kf10. On terminals that literally don't have function key support, you can get the same glow-up by pressing Esc and then a number in the range 1 through 9 and 0 (those map to F1 to F9 and F10 respectively). โจ
The File menu has the following commands (keyboard shortcuts in parentheses, bestie, iykyk):
- Help (
F1) โ Invokes the built-in hypertext help viewer. Inside the help viewer, you can use theTabkey to select the next link and theEnterkey to follow that link. The keysSpaceandBackspaceare used to move forward and backward in a help page. PressF1again to get the full list of accepted keys. ๐ - Menu (
F2) โ Invoke the user menu. The user menu provides an easy way to provide users with a menu and add extra features to Midnight Commander. ๐ซถ - View (
F3,F13) โ View the currently selected file. By default this invokes the Internal File Viewer, but if the option "Use internal view" is off, it invokes an external file viewer specified by theVIEWERenvironment variable. IfVIEWERis undefined, thePAGERenvironment variable is tried. IfPAGERis also undefined, theviewcommand is invoked. If you useF13instead, the viewer will be invoked without doing any formatting or preprocessing to the file. ๐
See parameters for external viewer for explain how you may specify an extended command line options for external viewers.
- Filtered View (
Alt-!) โ This command prompts for a command and its arguments (the argument defaults to the currently selected file name), and the output from such command is shown in the internal file viewer. ๐ - Edit (
F4,F14) โ PressF4to edit the highlighted file. PressF14(usuallyF14) to start the editor with a new, empty file. Currently they invoke thevieditor, or the editor specified in theEDITORenvironment variable, or the Internal File Editor if theuse_internal_editoption is on. ๐
See parameters for external editor for explain how you may specify an extended command line options for external editors.
- Copy (
F5,F15) โ PressF5to pop up an input dialog to copy the currently selected file (or the tagged files, if there is at least one file tagged) to the directory/filename you specify in the input dialog. The destination defaults to the directory in the non-selected panel. Space for the destination file may be preallocated relative to thepreallocate_spaceconfigure option. During this process, you can pressC-corEscto abort the operation. For details about source mask (which will be usually either*or^\(.*\)$depending on the setting of Use shell patterns) and possible wildcards in the destination, see Mask copy/rename. ๐ฆ
F15 (usually F15) is similar, but defaults to the directory in the selected panel. It always operates on the selected file, regardless of any tagged files.
On some systems, it is possible to do the copy in the background by clicking on the background button (or pressing Alt-b in the dialog box). The Background Jobs is used to control the background process. ๐ฅ
- Link (
C-x l) โ Create a hard link to the current file. - Absolute symlink (
C-x s) โ Create a absolute symbolic link to the current file. - Relative symLink (
C-x v) โ Create a relative symbolic link to the current file.
To those of you who don't know what links are: creating a link to a file is a bit like copying the file, but both the source filename and the destination filename represent the same file image. For example, if you edit one of these files, all the changes you make will appear in both files. Some people call links aliases or shortcuts. ๐
A hard link appears as a real file. After making it, there is no way of telling which one is the original and which is the link. If you delete either one of them the other one is still intact. It is very difficult to notice that the files represent the same image. Use hard links when you don't even want to know. ๐
A symbolic link is a reference to the name of the original file. If the original file is deleted the symbolic link is useless. It is quite easy to notice that the files represent the same image. Midnight Commander shows an "@"-sign in front of the file name if it is a symbolic link to somewhere (except to a directory, where it shows a tilde (~)). The original file which the link points to is shown on the mini-status line if the Show mini-status option is enabled. Use symbolic links when you want to avoid the confusion that can be caused by hard links. ๐ง
When you press "C-x s" Midnight Commander will automatically fill in the complete path+filename of the original file and suggest a name for the link. You can change either one.
Sometimes you may want to change the absolute path of the original into a relative path. An absolute path starts from the root directory:
/home/frodo/mc/mc -> /home/frodo/new/mc
A relative link describes the original file's location starting from the location of the link itself:
/home/frodo/mc/mc -> ../new/mc
You can force Midnight Commander to suggest a relative path by pressing "C-x v" instead of "C-x s". โจ
- Rename/Move (
F6,F16) โ PressF6to pop up an input dialog to copy the currently selected file (or the tagged files, if there is at least one file tagged) to the directory/filename you specify in the input dialog. The destination defaults to the directory in the non-selected panel. For more details look at the Copy (F5) operation above, most of the things are quite similar. ๐ธ
F16 (usually F16) is similar, but defaults to the directory in the selected panel. It always operates on the selected file, regardless of any tagged files.
On some systems, it is possible to do the copy in the background by clicking on the background button (or pressing Alt-b in the dialog box). The Background Jobs is used to control the background process. ๐ฅ
- Mkdir (
F7) โ Pop up an input dialog and creates the directory specified. - Delete (
F8) โ Delete the currently selected file or the tagged files in the currently selected panel. During the process, you can pressC-corEscto abort the operation. ๐ญ - Quick cd (
Alt-c) โ Use the quick cd command if you have full command line and want to cd somewhere. - Select group (
+) โ This is used to select (tag) a group of files. Midnight Commander will prompt for selection options. When theFiles onlycheckbox is on, only files will be selected. IfFiles onlyis off, as files as directories will be selected. When theShell Patternscheckbox is on, the regular expression is much like the filename globbing in the shell (*standing for zero or more characters and?standing for one character). IfShell Patternsis off, then the tagging of files is done with normal regular expressions (seeed(1)). When theCase sensitivecheckbox is on, the selection will be case sensitive characters. IfCase sensitiveis off, the case will be ignored. ๐ - Unselect group (
\) โ Used to unselect a group of files. This is the opposite of the Select group command. - Quit (
F10,S-F10) โ Terminate Midnight Commander.S-F10is used when you want to quit and you are using the shell wrapper.S-F10will not take you to the last directory you visited with Midnight Commander, instead it will stay at the directory where you started Midnight Commander. ๐
๐ Quick cd ๐
This command is useful if you have a full command line and want to cd somewhere without having to yank and paste the command line. This command pops up a small dialog, where you enter everything you would enter after cd on the command line and then you press enter. This features all the things that are already in the internal cd command. ๐
โญ Command Menu โญ
The Directory tree command shows a tree figure of the directories. ๐ณ
The "Find file" command allows you to search for a specific file.
The "Swap panels" command swaps the contents of the two directory panels.
The "Switch panels on/off" command shows the output of the last shell command. This works only on xterm and on Linux and FreeBSD console.
The "Compare directories" command compares the directory panels with each other. You can then use the Copy (F5) command to make the panels identical. There are three compare methods. The quick method compares only file size and file date. The thorough method makes a full byte-by-byte compare. The size-only compare method just compares the file sizes and does not check the contents or the date times, it just checks the file size. ๐
The "External panelize" allows you to execute an external program, and make the output of that program the contents of the current panel.
The "Command history" command shows a list of typed commands. The selected command is copied to the command line. The command history can also be accessed by typing Alt-p or Alt-n. ๐ฅ
The "Directory hotlist" command makes changing of the current directory to often used directories faster. ๐จ
The "Screen list" command shows a dialog window with the list of currently running internal editors, viewers and other MC modules that support this mode. ๐ฅ๏ธ
The "Edit extension file" command allows you to specify programs to executed when you try to execute, view, edit and do a bunch of other thing on files with certain extensions (filename endings). โจ
The "Edit Menu File" command may be used for editing the user menu (which appears by pressing F2). ๐
๐ณ Directory Tree ๐ณ
The Directory Tree command pops open a whole tree figure of your directories, and bestie, you just pick one and Midnight Commander moves you right into it. Simple as that. ๐
There's two ways to summon the tree:
- The real directory tree command โ it lives in the Commands menu.
- The other way: pick tree view from the Left or Right menu.
Now, so you don't sit there waiting forever โ no cap, long delays are the enemy โ Midnight Commander builds the tree figure by scanning only a small subset of all the directories. So if the directory you're hunting for is missing? Don't panic. Move to its parent directory and press C-r (or F2). โจ
Here's the keys you can use:
- General movement keys โ yeah, all of them are accepted. Go off. ๐ฆ
Enterโ In the directory tree, this exits the tree and changes to this directory in the current panel. In the tree view, it changes to this directory in the other panel and stays in tree view mode in the current panel.C-r,F2(Rescan) โ Rescans this directory. Use this whenever the tree figure is out of date: like when it's missing subdirectories or showing you some subdirectories that literally don't exist any more. Rude of it, honestly.F3(Forget) โ Deletes this directory from the tree figure. Perfect for removing clutter from the figure. Want it back? PressF2in its parent directory. ๐ซF4(Static/Dynamic) โ Toggles between the dynamic navigation mode (that's the default) and the static navigation mode.
In static navigation mode you use the Up and Down keys to select a directory. All known directories are shown.
In dynamic navigation mode you use Up and Down to select a sibling directory, the Left key to move to the parent directory, and the Right key to move to a child directory. Only the parent, sibling and children directories are shown โ everything else is left out. The tree figure changes dynamically as you traverse. ๐
F5(Copy) โ Copies the directory.F6(RenMov) โ Moves the directory.F7(Mkdir) โ Makes a new directory below this directory.F8(Delete) โ Deletes this directory from the file system. ๐C-s,Alt-sโ Searches the next directory matching the search string. And if there's no such directory? These keys just move you one line down. Fine. Whatever. ๐C-h,Backspaceโ Deletes the last character of the search string.- Any other character โ Adds the character to the search string and moves to the next directory which starts with these characters. Heads up though: in the tree view you must first activate search mode by pressing
C-s. The search string is shown in the mini status line. โจ
The following actions are available only in the directory tree. They aren't supported in the tree view:
F1(Help) โ Invokes the help viewer and shows this section.Esc,F10โ Exits the directory tree. Does not change the directory.
The mouse is supported. A double-click behaves like Enter. See also the section on mouse support. ๐ฑ๏ธ
๐ Find File ๐
The Find File feature first asks you for the start directory for the search and the filename to be searched for. Hit the Tree button and you can pick the start directory straight from the directory tree figure. Iconic. ๐ณ
The "File name" input field holds a filename pattern to search for. It gets interpreted as a shell pattern or as a regular expression depending on the state of the "Using shell patterns" checkbox. And an empty value is valid โ it matches any file name. ๐ฆ
The "Content" input field holds a string to search for within the files. Leave this field empty to disable searching file contents.
Option "Whole words" lets you select only those files containing matches that form whole words. Just like grep -w. ๐
You start the search by pressing the OK button. During the search you can stop from the Stop button and continue from the Start button. ๐ฅ
You can browse the filelist with the up and down arrow keys. The Chdir button changes to the directory of the currently selected file. The Again button asks for the parameters for a new search. The Quit button quits the search operation. The Panelize button places the found files into the current directory panel so you can do extra operations on them (view, copy, move, delete and so on). To get back to the normal file listing, change directory to "..". ๐
The 'Enable ignore directories' checkbox and the input field below it let you set up the list of directories that should be skipped during the file search โ for example, you may want to avoid searches on a CD-ROM or on a NFS directory that is mounted across a slow link. List components must be separated with a colon, here's an example:
/cdrom:/nfs/wuarchive:/afs
Relative paths are supported also. The following example shows how to skip special directories of version control systems:
/cdrom:/nfs/wuarchive:/afs:.svn:.git:CVS
Attention: the input field can contain a dot (.), and this means the current absolute path.
You may consider using the External panelize command for some operations. The Find file command is for simple queries only, while using External panelize you can do as mysterious searches as you would like. ๐ญโจ
๐ง External panelize ๐ง
External panelize lets you execute an external program, and then it makes the output of that program the contents of the current panel. It's giving "the panel is whatever I say it is." ๐
For example, if you want to manipulate in one of the panels all the symbolic links in the current directory, you can use external panelization to run the following command:
find . -type l -print
Once the command completes, the directory contents of the panel will no longer be the directory listing of the current directory, but all the files that are symbolic links. Slay. ๐ฆ
And if you want to panelize all of the files that have been downloaded from your FTP server, you can use this awk command to extract the file name from the transfer log files:
awk '$9 ~! /incoming/ { print $9 }' < /var/log/xferlog
You may want to save often used panelize commands under a descriptive name so you can recall them quickly. You do this by typing the command on the input line and pressing the Add new button. Then you enter a name under which you want the command to be saved. Next time, you just choose that command from the list and don't have to type it again. Future you says thank you. ๐
โญ Hotlist โญ
The Directory hotlist command shows the labels of the directories in the directory hotlist. Midnight Commander changes to the directory corresponding to the selected label. From the hotlist dialog you can remove already created label/directory pairs and add new ones. ๐
To add new directories quickly, you can use the Add to hotlist command (C-x h), which adds the current directory into the directory hotlist, asking just for the label for the directory. โจ
This makes cd to often used directories faster. You may consider using the CDPATH variable as described in the internal cd command description. ๐
๐ Edit Extension File ๐
This will invoke your editor on the file ~/.config/mc/mc.ext.ini. If this file does not exist and you are not root, it will be copied from /etc/mc/mc.ext.ini. If you are root, you can choose the file to edit: user's ~/.config/mc/mc.ext.ini or system-wide /etc/mc/mc.ext.ini. The format of this file is described in detail in it. ๐
๐ Background Jobs ๐
This lets you control the state of any background Midnight Commander process (only copy and move files operations can be done in the background). You can stop, restart and kill a background job from here. No cap. ๐ฅ
๐ Edit Menu File ๐
okay bestie, the user menu is literally a menu of useful actions that you can customize yourself. When you open the user menu, mc looks for .mc.menu in the current directory โ and it only uses it if it exists, is owned by user or root, and is not world-writable. If no such file is found, it tries ~/.config/mc/menu in the exact same way. And if that's also a no, mc falls back to the default system-wide menu at /usr/share/mc/mc.menu. periodt. ๐
The format is super simple, no cap. Lines that start with anything but space or tab are menu entries (and if you want it to work like a hot key, the first character should be a letter). All the lines that start with a space or a tab are the commands that run when you select that entry.
When an option is selected, all the command lines of that option get copied to a temporary file in the temporary directory (usually /usr/tmp) and then that file is executed. That's what lets you put normal shell constructs in your menus. Also, simple macro substitution happens before the menu code runs. For more info, see macro substitution.
Here's a sample mc.menu file, bestie โ copy it, remix it, make it yours:
A Dump the currently selected file
od -c %f
B Edit a bug report and send it to root
I=`mktemp ${MC_TMPDIR:-/tmp}/mail.XXXXXX` || exit 1
vi $I
mail -s "Midnight Commander bug" root < $I
rm -f $I
M Read mail
emacs -f rmail
N Read Usenet news
emacs -f gnus
H Call the info hypertext browser
info
J Copy current directory to other panel recursively
tar cf - . | (cd %D && tar xvpf -)
K Make a release of the current subdirectory
echo -n "Name of distribution file: "
read tar
ln -s %d `dirname %d`/$tar
cd ..
tar cvhf ${tar}.tar $tar
= f *.tar.gz | f *.tgz & t n
X Extract the contents of a compressed tar file
tar xzvf %f
๐ Default Conditions ๐
Each menu entry can have a condition in front of it. The condition has to start in the first column with a = character. If the condition is true, that menu entry becomes the default entry. iconic behavior, honestly. โจ
Condition syntax:
= <sub-cond>
or:
= <sub-cond> | <sub-cond> ...
or:
= <sub-cond> & <sub-cond> ...
A sub-condition is one of these cuties:
y <pattern>โ syntax of current file matching pattern? (for edit menu only)f <pattern>โ current file matching pattern?F <pattern>โ other file matching pattern?d <pattern>โ current directory matching pattern?D <pattern>โ other directory matching pattern?t <type>โ current file of type?T <type>โ other file of type?x <filename>โ is it executable filename?! <sub-cond>โ negate the result of sub-condition
Pattern is a normal shell pattern or a regular expression, according to the shell patterns option. You can override the global value of the shell patterns option by writing "shell_patterns=x" on the first line of the menu file (where "x" is either 0 or 1).
Type is one or more of these characters:
nโ not a directoryrโ regular filedโ directorylโ linkcโ character devicebโ block devicefโ FIFO (pipe)sโ socketxโ executable filetโ tagged
For example 'rlf' means either regular file, link or fifo. The 't' type is a little special because it acts on the panel instead of the file. The condition '=t t' is true if there are tagged files in the current panel and false if not.
If the condition starts with '=?' instead of '=', a debug trace will be shown whenever the value of the condition is calculated.
The conditions are calculated from left to right. So this:
= f *.tar.gz | f *.tgz & t n
is calculated as:
( (f *.tar.gz) | (f *.tgz) ) & (t n)
Here's a sample of conditions in action:
= f *.tar.gz | f *.tgz & t n
L List the contents of a compressed tar-archive
gzip -cd %f | tar xvf -
๐ธ Addition Conditions ๐ธ
If the condition begins with '+' (or '+?') instead of '=' (or '=?'), it's an addition condition. If the condition is true, the menu entry will be included in the menu. If it's false, the menu entry will not be included. simple as that. ๐ฆ
You can combine default and addition conditions by starting the condition with '+=' or '=+' (or '+=?' or '=+?' if you want debug trace). If you want to use two different conditions โ one for adding and another for defaulting โ you can put two condition lines before a menu entry, one starting with '+' and another starting with '='.
Comments start with '#'. The additional comment lines must start with '#', space or tab.
โจ Options Menu โจ
Midnight Commander has some options that may be toggled on and off in several dialogs which are accessible from this menu. Options are enabled if they have an asterisk or "x" in front of them. ๐
- Configuration command โ pops up a dialog from which you can change most of settings of Midnight Commander.
- Layout command โ pops up a dialog from which you specify a bunch of options how mc looks like on the screen.
- Panel options command โ pops up a dialog from which you specify options of file manager panels.
- Confirmation command โ pops up a dialog from which you specify which actions you want to confirm.
- Appearance command โ pops up a dialog from which you specify the skin.
- Display bits command โ pops up a dialog from which you may select which characters is your terminal able to display.
- Learn keys command โ pops up a dialog from which you test some keys which are not working on some terminals and you may fix them.
- Virtual FS command โ pops up a dialog from which you specify some VFS related options.
- Save setup command โ saves the current settings of the Left, Right and Options menus. A small number of other settings is saved, too.
Configuration ๐
The options in this dialog are split into several groups, bestie: "File operation options", "Esc key mode", "Pause after run" and "Other options". Slay.
File operation options โจ
- Verbose operation. โ This toggles whether the file Copy, Rename and Delete operations are verbose (i.e., they display a dialog box for each operation). If your terminal is slow, you may wish to disable the verbose operation. It is automatically turned off if the speed of your terminal is less than
9600bps. - Compute totals. โ If this option is enabled, Midnight Commander computes total byte sizes and total number of files prior to any Copy, Rename and Delete operations. This gives you a more accurate progress bar at the expense of some speed. This option has no effect if Verbose operation is disabled.
- Classic progressbar. โ If this option is enabled, the progressbar of Copy/Move/Delete operations is always grown form left to right. If disabled, the growing direction of progressbar follows to direction of Copy/Move/Delete operation: from left panel to right one and vice versa. Enabled by default.
- Mkdir autoname. โ When you press
F7to create a new directory, the input line in popup dialog will be filled by name of current file or directory in active panel. Disabled by default. - Preallocate space. โ Preallocate space for whole target file, if possible, before copy operation. Disabled by default.
Esc key mode. ๐ฆ
By default, Midnight Commander treats the Esc key as a key prefix. Therefore, you should press Esc code twice to exit a dialog. But there is a possibility to use a single press of Esc key for that action.
- Single press. โ By default this option is disabled. If you enable it, the
Esckey will act as a prefix key for set up time interval (see Timeout option below), and if no extra keys have arrived, then theEsckey is interpreted as a cancel key (Esc Esc). - Timeout. โ This option is used to setup the time interval (in microseconds) for single press of
Esckey. By default, this interval is one second (1000000microseconds). Also the timeout can be set viaKEYBOARD_KEY_TIMEOUT_USenvironment variable (also in microseconds), which has higher priority than Timeout option value.
Pause after run ๐ธ
After executing your commands, Midnight Commander can pause, so that you can examine the output of the command. There are three possible settings for this variable:
- Never. โ Means that you do not want to see the output of your command. If you are using the Linux or FreeBSD console or an xterm, you will be able to see the output of the command by typing
C-o. - On dumb terminals. โ You will get the pause message on terminals that are not capable of showing the output of the last command executed (any terminal that is not an xterm or the Linux console).
- Always. โ The program will pause after executing all of your commands.
Other options ๐
- Use internal editor. โ If this option is enabled, the built-in file editor is used to edit files. If the option is disabled, the editor specified in the
EDITORenvironment variable is used. If no editor is specified,viis used. See the section on the internal file editor. - Use internal viewer. โ If this option is enabled, the built-in file viewer is used to view files. If the option is disabled, the pager specified in the
PAGERenvironment variable is used. If no pager is specified, theviewcommand is used. See the section on the internal file viewer. - Ask new file name. โ If this option is enabled, file name is asked before open new file in editor.
- Auto menus. โ If this option is enabled, the user menu will be invoked at startup. Useful for building menus for non-unixers.
- Drop down menus. โ When this option is enabled, the pull down menus will be activated as soon as you press the
F9key. Otherwise, you will only get the menu title, and you will have to activate the menu either with the arrow keys or with the hotkeys. It is recommended if you are using hotkeys. - Shell Patterns. โ By default the Select, Unselect and Filter commands will use shell-like regular expressions. The following conversions are performed to achieve this: the
'*'is replaced by'.*'(zero or more characters); the'?'is replaced by'.'(exactly one character) and'.'by the literal dot. If the option is disabled, then the regular expressions are the ones described ined(1). - Complete: show all. โ By default, Midnight Commander pops up all possible completions if the completion is ambiguous only when you press
Alt-Tabfor the second time. For the first time, it just completes as much as possible and beeps in the case of ambiguity. Enable this option if you want to see all possible completions even after pressingAlt-Tabthe first time. - Rotating dash. โ If this option is enabled, the Midnight Commander shows a rotating dash in the upper right corner as a work in progress indicator.
- Cd follows links. โ This option, if set, causes Midnight Commander to follow the logical chain of directories when changing current directory either in the panels, or using the
cdcommand. This is the default behavior ofbash. When unset, Midnight Commander follows the real directory structure, socd ..if you've entered that directory through a link will move you to the current directory's real parent and not to the directory where the link was present. - Safe delete. โ If this option is enabled, deleting files and directory hotlist entries unintentionally becomes more difficult. The default selection in the confirmation dialogs for deletion changes from Yes to No. This option is disabled by default.
- Safe overwrite. โ If this option is enabled, overwriting files unintentionally becomes more difficult. The default selection in the overwrite confirmation dialog changes from Yes to No. This option is disabled by default.
- Auto save setup. โ If this option is enabled, when you exit Midnight Commander, the configurable options of Midnight Commander are saved in the
~/.config/mc/inifile.
Layout ๐
The layout dialog gives you a possibility to change the general layout of screen. The options in this dialog are divided into several groups: "Panel split", "Console output" and "Other options".
Panel split โจ
The rest of the screen area is used for the two directory panels. You can specify whether the area is split to the panels in Vertical or Horizontal direction. Panel layout can be changed using Alt-, (Alt-comma) shortcut.
- Equal split. โ By default, panels have equal sizes. Using this option you can specify an unequal split.
Console output ๐ฆ
On the Linux or FreeBSD console you can specify how many lines are shown in the output window. This option is available if Midnight Commander runs on native console only.
Other options ๐
- Menu bar visible. โ If enabled, main menu of Midnight Commander is always visible on the top row of screen above panels. Enabled by default.
- Command prompt. โ If enabled, command line is available. Enabled by default.
- Keybar visible. โ If enabled,
10labels associated withF1-F10keys are located at the bottom row of screen. Enabled by default. - Hintbar visible. โ If enabled, the one-line hints are visible below panels. Enabled by default.
- XTerm window title. โ When run in a terminal emulator for X11, Midnight Commander sets the terminal window title to the current working directory and updates it when necessary. If your terminal emulator is broken and you see some incorrect output on startup and directory change, turn off this option. Enabled by default.
- Show free space. โ If enabled, free space and total space of current file system is shown at the bottom frame of panel. Enabled by default.
โจ Panel options โจ
Main panel options ๐
- Show mini-status โ turn this on and you get one lil line of status tea about whatever item is currently selected, chillin' at the bottom of the panels. On by default.
- Use SI size units โ flip this on and Midnight Commander shows byte sizes with SI prefixes (base 10). Leave it off (the default) and it uses IEC prefixes (base 2) instead. pick ur units bestie.
- Mix all files โ on = every file AND directory is shown all mixed together, no separation. off (default) = directories (and links to directories) go up top first, everything else below. organized queen behavior tbh.
- Show backup files โ on = MC shows files that end with a tilde
~. off = they don't show up at all, kinda like GNU'slsoption-B. Enabled by default. - Show hidden files โ on = MC shows every file starting with a dot, just like
ls -a. Disabled by default. - Fast directory reload โ this one is a lil trick โจ when it's on, MC only reloads a directory if the directory's i-node has changed. translation: reloads only happen when files get created or deleted. If what changes is the i-node of a file inside the directory (size change, mode change, owner change, etc.), the display does NOT update. So if u got this on, u gotta rescan the directory manually with
C-r. Disabled by default.
Heads up bestie โ with this on, the panel can go stale on u. C-r is ur bestie here.
- Mark moves down โ on = the selection bar moves down when u mark a file (with the
Insertkey). Enabled by default. - Reverse files only โ lets u revert selection of files only. Enabled by default. When it's on, the reverse selection only hits files, not directories โ directory selections are left completely untouched. Turn it off and the reverse selection hits files AND directories: every unselected item becomes selected and vice versa. chaos mode, respectfully.
- Simple swap โ if both panels have a file listing, simple swap means the panels just exchange their screen positions: left panel becomes the right one and vice versa. If this option is unchecked, the file listing panels exchange their content while keeping their listing format and sort options. Unchecked by default.
- Auto save panels setup โ on = when u exit Midnight Commander, ur current panel settings get saved into the
~/.config/mc/panels.inifile. Disabled by default.
Navigation ๐งญ
- Lynx-like motion โ on = u can use the arrow keys to automatically
chdirif ur current selection is a subdirectory and the shell command line is empty. By default, this setting is off. - Page scrolling โ if set (the default), the panel scrolls by half the display when the cursor reaches the end or the beginning of the panel. Otherwise it just scrolls one file at a time.
- Center scrolling โ if set, the panel scrolls when the cursor reaches the middle of the panel column, and only hits the top or bottom of the panel when ur actually on the first or last file. This behavior applies when scrolling one file at a time, and does not apply to the page up/down keys.
- Mouse page scrolling โ controls whether scrolling with the mouse wheel on the panels happens by pages or line by line. ur call.
File highlight ๐
U can specify whether permissions and file types get highlighted with distinctive Colors. If permission highlighting is enabled, the parts of the perm and mode display fields that apply to the user running Midnight Commander get highlighted with the color defined by the selected keyword. If file type highlighting is enabled, file names get colored according to rules described in the /etc/mc/filehighlight.ini file. See Filenames Highlight for more info.
Quick search ๐
U can specify how the Quick search mode should work: case insensitively, case sensitively, or matched to the panel sort order โ case sensitive or not. pick ur vibe.
โจ Confirmation โจ
In this dialog u configure the confirmation options for: file deletion, overwriting files, execution by pressing enter, quitting the program, directory hotlist entries deletion, and history cleanup. all the "r u SURE bestie" moments, in one place. ๐ซถ
โจ Appearance โจ
In this dialog u can select the skin to be used and enable shadow for dialogs and drop down menus.
See the Skins section for technical details about the skin definition files.
- Shadows โ if this option is enabled, all dialogs and drop down menus will have a shadow. aesthetic. โจ
โจ Display bits โจ
This is used to configure the range of visible characters on the screen. This setting may be:
7-bitsโ if ur terminal/curses only supports seven output bitsISO-8859-1โ displays all the characters in theISO-8859-1mapfull 8 bitsโ for those terminals that can display full 8 bit characters
โจ Learn keys โจ
This dialog lets u test and redefine functional keys, cursor arrows and some other keys so they actually work properly on ur terminal. ngl they often don't, since so many terminal databases are incomplete or straight-up broken. ๐
U can move around with the Tab key and with the vi moving keys (h left, j down, k up and l right). Once u press any cursor movement key and it's recognized, u can use that key as well.
U can test keys just by pressing each of them. When u press a key and it's recognized properly, OK should appear next to the name of that key. Once a key is marked OK it starts working as usually โ like, F1 pressed the first time will just check that the F1 key works, but after that it will show help. Same applies to the arrow keys. The Tab key should be working always.
If some keys do not work properly then u won't see OK appear after pressing one of these. Then u may want to redefine it. Do it by pressing the button with the name of that key (either with the mouse, or by Enter or Space after selecting the button with Tab or the arrows). Then a message box will appear asking u to press that key. Do it and wait until the message box disappears. If u want to abort, just press Escape once and wait. ๐ง
When u finish with all the keys, u can Save them. The definitions for the keys u have redefined will be written into the [terminal:TERM] section of ur ~/.config/mc/ini file (where TERM is the name of ur current terminal). The definitions of the keys that were already working properly are not saved.
โจ Virtual FS โจ
This option gives u control over the settings of the Virtual File System. ๐
Midnight Commander keeps in memory the information related to some of the virtual file systems to speed up access to the files in the file system (for example, directory listings fetched from FTP servers).
Also, in order to access the contents of compressed files (for example, compressed tar files), Midnight Commander needs to create temporary uncompressed files on ur disk.
Since both the information in memory and the temporary files on disk take up resources, u may want to tune the parameters of the cached information to decrease ur resource usage, or to maximize the speed of access to frequently used file systems. balance, bestie.
Because of the format of the tar archives, the Tar filesystem needs to read the whole file just to load the file entries. Since most tar files are usually kept compressed (plain tar files are species in extinction ๐), the tar file system has to uncompress the file on the disk in a temporary location and then access the uncompressed file as a regular tar file.
Now, since we all love to browse files and tar files all over the disk, it's common that u will leave a tar file and then re-enter it later. Since decompression is slow, Midnight Commander will cache the information in memory for a limited time. When the timeout expires, all the resources associated with the file system are released. The default timeout is set to one minute.
The FTP File System (ftpfs) allows u to browse directories on remote FTP servers. It has several options:
- ftp anonymous password โ the password used when u login as
"anonymous". Some sites require a valid e-mail address. On the other hand, u probably don't want to give ur real e-mail address to untrusted sites, especially if ur not using spam filtering. ๐ ftpfskeeps the directory listing it fetches from an FTP server in a cache. The cache expire time is configurable with the ftpfs directory cache timeout option. A low value for this option may slow down every operation on theftpfs, because every operation would require sending a request to the FTP server. so like, tradeoffs.- U can define an FTP proxy host for doing FTP. Note that most modern firewalls are fully transparent at least for passive FTP (see below), so FTP proxies are considered obsolete.
- If Always use ftp proxy is not set, u can use the exclamation sign to enable proxy for certain hosts. See FTP File System for examples.
- If this option is set, the program will do two things: consult the
/etc/mc/mc.no_proxyfile for lines containing host names that are local (if the host name starts with a dot, it is assumed to be a domain), and assume that any hostnames without dots in their names are directly accessible. All other hosts will be accessed through the specified FTP proxy. - U can enable using the
~/.netrcfile, which keeps login names and passwords for ftp servers. Seenetrc (5)for the description of the.netrcformat. - Use passive mode โ enables using FTP passive mode, where the connection for data transfer is initiated by the client, not by the server. This option is recommended and enabled by default. If this option is turned off, the data connection is initiated by the server. This may not work with some firewalls.
โจ Save Setup โจ
At startup, Midnight Commander tries to load initialization information from the ~/.config/mc/ini file. If this file doesn't exist, the system-wide file /etc/mc/mc.ini is used. If that file doesn't exist, the system-wide file /usr/share/mc/mc.ini is used. If that file doesn't exist either, MC uses the default settings.
The Save Setup command creates the ~/.config/mc/ini file by saving the current settings of the Left, Right and Options menus.
If u activate the auto save setup option, MC will always save the current settings when exiting.
There also exist settings which can't be changed from the menus. To change these settings u have to edit the setup file with ur favorite editor. See the section on Special Settings for more information. ๐
๐ฅ๏ธ Executing operating system commands
Okay so, two ways to run stuff, bestie ๐
- You can just type the command straight into Midnight Commander's input line.
- Or you scroll the selection bar in a panel until it's sitting on the program you wanna run, and hit Enter. Boom. Done.
Now here's the lil plot twist ๐ซฃ โ if you press Enter over a file that is not executable, MC goes and checks that file's extension against the extensions in the Extensions File. If it finds a match, the code tied to that extension gets executed. And before the command runs, a very simple macro expansion happens first. So it's giving "we checked your vibe before we ran anything" โจ
๐ The cd internal command
The cd command is handled by Midnight Commander itself, it is not passed off to the command shell for execution. Which means it may not handle all of the nice macro expansion and substitution that your shell does ๐ญ โ but it does do some of them:
- Tilde substitution. The
~gets substituted with your home directory. And if you append a username after the tilde, it gets substituted with the login directory of that specified user.
Like fr, ~guest is the home directory for the user guest, while ~/guest is the directory guest inside your home directory. Sneaky difference, iykyk ๐
- Previous directory. You can jump back to the directory you were in previously by using the special directory name
-, like this:
cd -
- CDPATH directories. If the directory you gave to
cdisn't in the current directory, Midnight Commander uses the value in the environment variableCDPATHto search for the directory in any of the named directories.
So like, you could set your CDPATH variable to ~/src:/usr/src, letting you change your directory to any of the directories inside the ~/src and /usr/src directories, from any place in the file system, just by using its relative name. For example cd linux could take you to /usr/src/linux. Lowkey magical ๐ช
๐ช Macro Substitution
When you access a user menu, or execute an extension dependent command, or run a command from the command line input, a simple macro substitution takes place. Here are all the macros, and yes I'm listing every single one, no skipping ๐
%iโ The indent of blank space, equal the cursor column position. For edit menu only.%yโ The syntax type of current file. For edit menu only.%kโ The block file name.%eโ The error file name.%mโ The current menu name.%fand%pโ In file manager user menu: the current file name in selected panel. In mcedit user menu: the name of opened file.%xโ The extension of current file name.%bโ The current file name without extension.%dโ The current directory name.%Fโ The current file in the unselected panel.%Dโ The directory name of the unselected panel.%tโ The currently tagged files.%Tโ The tagged files in the unselected panel.%uand%Uโ Similar to the%tand%Tmacros, but in addition the files are untagged. You can use this macro only once per menu file entry or extension file entry, because next time there will be no tagged files. (One and done, bestie ๐)%sand%Sโ The selected files: The tagged files if there are any. Otherwise the current file.%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 Virtual File System.%viewโ This macro is used to invoke the internal viewer. This macro can be used alone, or with arguments. If you pass any arguments to this macro, they should be enclosed in brackets.
The arguments are: ascii to force the viewer into ascii mode; hex to force the viewer into hex mode; nroff to tell the viewer that it should interpret the bold and underline sequences of nroff; unformatted to tell the viewer to not interpret nroff commands for making the text bold or underlined.
%%โ The%character%{some text}โ Prompt for the substitution. An input box is shown and the text inside the braces is used as a prompt. The macro is substituted by the text typed by the user. The user can press Esc or F10 to cancel. This macro doesn't work on the command line yet.%var{ENV:default}โ If environment variableENVis unset, the default is substituted. Otherwise, the value ofENVis substituted.
๐ The subshell support
The subshell support is a compile time option, that works with the shells: bash, ash (BusyBox and Debian), (o/m)ksh, tcsh, zsh and fish.
When the subshell support is active, Midnight Commander will spawn a concurrent copy of your shell (the one defined in the SHELL variable and if it is not defined, then the one in the /etc/passwd file) and run it in a pseudo terminal. Instead of invoking a new shell each time you execute a command, the command will be passed to the subshell as if you had typed it. This also lets you change the environment variables, use shell functions and define aliases that are valid until you quit Midnight Commander. Immaculate vibes, honestly ๐ซถ
Startup command files per shell, because everyone deserves their own lil home:
bashusers may specify startup commands in~/.local/share/mc/bashrc(fallback~/.bashrc) and special keyboard maps in~/.local/share/mc/inputrc(fallback~/.inputrc).ash/dashusers (BusyBox or Debian) may specify startup commands in~/.local/share/mc/ashrc(fallback~/.profile).ksh/okshusers (PD ksh variants) may specify startup commands in~/.local/share/mc/kshrc(fallbackENVor~/.profile).mkshusers (MirBSD ksh) may specify startup commands in~/.local/share/mc/mkshrc(fallbackENVor~/.mkshrc).zshusers may specify startup commands in~/.local/share/mc/.zshrc(fallback~/.zshrc).tcsh,fishusers cannot specify mc-specific startup commands at present. They have to rely on shell-specific startup files. ๐ (justice for tcsh and fish tbh)
The following paragraphs are relevant only when the subshell support is active:
You can suspend applications at any time with the sequence C-o and jump back to Midnight Commander. But heads up โ if you interrupt an application, you will not be able to run other external commands until you quit the application you interrupted. So like, don't get stuck ๐
The basic prompt displayed by Midnight Commander is of the form "user@host:current_path$ ". When using a capable shell, like Bash, the prompt displayed by Midnight Commander will be the same prompt that you are currently using in your shell. Glow-up inherited, periodt โจ
(There's a known problem when using fish: the prompt is displayed only in full screen mode (Ctrl-o), not when the panels are visible.)
The OPTIONS section has more info on how you can control subshell usage (-U/-u). Furthermore, to set a specific subshell different from your current SHELL variable or login shell defined in /etc/passwd, you may call MC like this:
SHELL=/bin/myshell mc
๐ Chmod
The Chmod window is used to change the attribute bits in a group of files and directories. It can be invoked with the C-x c key combination.
The Chmod window has two parts โ Permissions and File.
In the File section are displayed the name of the file or directory and its permissions in octal form, as well as its owner and group.
In the Permissions section there is a set of check buttons which correspond to the file attribute bits. As you change the attribute bits, you can see the octal value change in the File section. Watching numbers shift in real time? That's the content ๐
To move between the widgets (buttons and check buttons) use the arrow keys or the Tab key. To change the state of the check buttons or to select a button use Space. You can also use the hotkeys on the buttons to quickly activate them. Hotkeys are shown as highlighted letters on the buttons.
To set the attribute bits, use the Enter key.
When working with a group of files or directories, you just click on the bits you want to set or clear. Once you have selected the bits you want to change, you select one of the action buttons (Set marked or Clear marked).
Finally, to set the attributes exactly to those specified, you can use the [Set all] button, which will act on all the tagged files.
[Marked all]โ set only marked attributes to all selected files[Set marked]โ set marked bits in attributes of all selected files[Clean marked]โ clear marked bits in attributes of all selected files[Set]โ set the attributes of one file[Cancel]โ cancel the Chmod command
๐ Chown
The Chown command is used to change the owner/group of a file. The hot key for this command is C-x o.
โจ Advanced Chown
The Advanced Chown command is the Chmod and Chown command combined into one window. You can change the permissions and owner/group of files at once. Two for one, we love a combo deal ๐
๐ง Chattr
The Chattr window is used to change the attributes of a group of files and directories on a Linux file system. It can be invoked with the C-x e key combination.
Not all attributes are supported or utilized by all filesystems. List of available attribute flags is represented as a set of check buttons which correspond to the attribute flags (see chattr(1) for details). As you change the attribute flags, you can see the symbolic value change below file name.
To move between the widgets (buttons and check buttons) use the arrow keys or the Tab key. To change the state of the check buttons or to select a button use Space.
To set the attributes, use the Enter key.
When working with a group of files or directories, you just click on the flags you want to set or clear. Once you have selected the flags you want to change, you select one of the action buttons (Set marked or Clear marked).
Finally, to set the attributes exactly to those specified, you can use the [Set all] button, which will act on all the tagged files.
[Marked all]โ set only marked attributes to all selected files.[Set marked]โ set marked flags in attributes of all selected files.[Clean marked]โ clear marked flags in attributes of all selected files.[Set]โ set the attributes of one file.[Cancel]โ cancel the Chattr command.
๐ File Operations ๐
okay bestie, so when you copy, move or delete files, Midnight Commander pops up the file operations dialog. It shows the files currently being processed and uses up to two progress bars. The file bytes bar tells you the percentage of the current file that's been handled so far. The total bytes bar tells you the percentage of the total size of all the tagged files that's been handled. There are also counters showing how many of the tagged files have been handled. If the Verbose option is off, neither the file bytes bar nor the total bytes bar shows up. ๐
There are three buttons at the bottom of that dialog:
[Skip]โ skip the rest of the current file.[Suspend]โ suspend the file operation, and then this button turns into[Continue], which continues the suspended operation.[Abort]โ abort the whole operation, and the rest of the files are skipped.
There are three other dialogs you can run into during file operations. ๐ซถ
The error dialog tells you about error conditions and gives you four choices:
[Ignore]โ ignore this error.[Ignore all]โ ignore this error and all future errors.[Abort]โ abort the operation altogether.[Retry]โ continue if you fixed the problem from another terminal.
The replace dialog shows up when you try to copy or move a file on top of an existing file. It shows the dates and sizes of both files. Buttons in this dialog:
[Yes]โ overwrite the file.[No]โ skip the file.[Append]โ append the source file to the target one.[Reget]โ append the rest of the source file to the target one. This button only appears if the target file's size is non-zero and less than the source file's size.[All]โ overwrite all the files.[Older]โ overwrite if the source file is newer than the target file.[None]โ never overwrite files.[Smaller]โ overwrite if the source file size is less than the target one.[Size differs]โ overwrite files with different sizes.[Abort]โ abort the whole operation.
If the Don't overwrite with zero length file checkbox is on, zero-sized source files won't overwrite non-zero-sized target files.
The recursive delete dialog appears when you try to delete a directory that isn't empty. Buttons:
[Yes]โ delete the directory recursively.[No]โ skip the directory.[All]โ delete all the directories.[None]โ skip all the non-empty directories.[Abort]โ abort the whole operation.
If you have tagged files and you perform an operation on them, only the files where the operation succeeded get untagged. Failed and skipped files stay tagged. ๐
๐ Mask Copy/Rename ๐
The copy/move operations let you translate file names in a super easy way. To do it, you specify the correct source mask, and usually in the trailing part of the destination you specify some wildcards. All files matching the source mask get copied/renamed according to the target mask. If there are tagged files, only the tagged files matching the source mask get renamed. โจ
There are other options you can set:
- Follow links โ determines whether symlinks and hardlinks in the source directory (recursively in subdirectories) become new links in the target directory, or whether you'd rather copy their content.
- Dive into subdirs โ determines what happens when the source directory is about to be copied but the target directory already exists. The default action is to copy the contents of the source directory into the target directory. Enabling this option copies the source directory itself into the target directory.
For example, you want to copy directory /foo containing file bar to /bla/foo, which is already an existing directory. Normally (when Dive into subdirs is not set), mc would copy file /foo/bar into the file /bla/foo/bar. By enabling this option, the /bla/foo/foo directory gets created, and /foo/bar is copied into /bla/foo/foo/bar.
- Preserve attributes โ determines whether to preserve permissions, timestamps and (if you're root) the ownership of the original files. If this option isn't set, the current value of the
umaskis respected. - Use shell patterns โ when this is on, you can use the
*and?wildcards in the source mask. They work like they do in the shell. In the target mask, only the*and\<digit>wildcards are allowed. The first*wildcard in the target mask corresponds to the first wildcard group in the source mask, the second*corresponds to the second group, and so on. The\1wildcard corresponds to the first wildcard group in the source mask,\2corresponds to the second group, and so on all the way up to\9. The\0wildcard is the whole filename of the source file.
Two examples:
- If the source mask is
*.tar.gz, the destination is/bla/*.tgz, and the file to be copied isfoo.tar.gz, the copy will befoo.tgzin/bla. - Suppose you want to swap basename and extension so that
file.cbecomesc.fileand so on. The source mask for this is*.*and the destination is\2.\1.
- Use shell patterns off โ when the shell patterns option is off, MC doesn't do automatic grouping anymore. You must use
\(...\)expressions in the source mask to specify meaning for the wildcards in the target mask. This is more flexible but also requires more typing. Otherwise target masks are similar to when the shell patterns option is on.
Two examples:
- If the source mask is
^\(.*\)\.tar\.gz$, the destination is/bla/*.tgz, and the file to be copied isfoo.tar.gz, the copy will be/bla/foo.tgz. - Let's suppose you want to swap basename and extension so that
file.cbecomesc.fileand so on. The source mask for this is^\(.*\)\.\(.*\)$and the destination is\2.\1.
- Case Conversions โ you can also change the case of filenames. If you use
\uor\lin the target mask, the next character gets converted to uppercase or lowercase correspondingly.
If you use \U or \L in the target mask, the next characters get converted to uppercase or lowercase correspondingly up to the next \E or next \U, \L, or the end of the file name.
The \u and \l are stronger than \U and \L.
For example, if the source mask is * (Use shell patterns on) or ^\(.*\)$ (Use shell patterns off) and the target mask is \L\u*, the file names will be converted to have initial upper case and otherwise lower case.
You can also use \ as a quote character. For example, \\ is a backslash and \* is an asterisk.
- Stable symlinks โ commands Midnight Commander that it should change symlinks in the target so they'll point to the same location as they did before. With absolute symbolic links this does nothing, but if you have a relative one, it will recompute its value, adding necessary
../and other directory parts and making the value as short as possible (most modern filesystems keep short symlinks inside inodes and thus don't waste much disk space).
๐ธ Select/Unselect Files ๐ธ
This dialog is for selecting or unselecting a group of files and directories. The input line lets you enter the regular expression of filenames that will be selected/unselected. ๐
- When the Files only checkbox is on, only files get selected. If Files only is off, both files and directories get selected.
- When the Shell Patterns checkbox is on, the regular expression is much like filename globbing in the shell (
*stands for zero or more characters and?stands for one character). If Shell Patterns is off, then tagging of files is done with normal regular expressions (seeed (1)). - When the Case sensitive checkbox is on, the selection will be case sensitive. If Case sensitive is off, the case is ignored.
โจ Internal Diff Viewer โจ
The mcdiff is a visual diff tool. You can compare two files and edit them in-place (diffs are updated dynamically). You can browse and view a working copy from popular version control systems (GIT, Subversion, etc). ๐ฆ
These shortcuts are available in the internal diff viewer of Midnight Commander:
F1โ invoke the built-in hypertext help viewer.F2โ save modified files.F4โ edit the file of the left panel in the internal editor.F14โ edit the file of the right panel in the internal editor.F5โ merge the current hunk. Only the current hunk will be merged.F7โ start search.F17โ continue search.F10,Esc,qโ exit from the diff viewer.Alt-s,sโ toggle show of hunk status.Alt-n,lโ toggle show of line numbers.fโ maximize left panel.=โ make panels equal in width.>โ reduce the size of the right panel.<โ reduce the size of the left panel.cโ toggle show of trailing carriage return (CR) symbol as^M.2,3,4,8โ set tabulation size.C-uโ swap contents of diff panels.C-rโ refresh the screen.C-oโ switch to the subshell and show the command screen.Enter,Space,nโ find next diff hunk.Backspace,pโ find previous diff hunk.gโ go to line.Downโ scroll one line forward.Upโ scroll one line backward.PageUpโ move one page up.PageDownโ moves one page down.Home,A1โ moves to the line beginning.Endโ moves to the line end.C-Homeโ move to the file beginning.C-End,C1โ move to the file end.
Internal File Viewer ๐ธ
Okay bestie, the internal file viewer is literally giving dual-display energy โ it's got two display modes: ASCII and hex. To bop between them, hit F4. Simple as.
The viewer is gonna try to use the best method your system or the file type has to offer to show you the info. Some character sequences โ the ones that show up most in preformatted manual pages โ get displayed bold and underlined, so your files look all pretty and slay. ๐
When you're in hex mode, the search function accepts text in quotes and constant numbers. Text in quotes gets matched exactly after the quotes come off. Each number matches one byte. You can mix quoted text with constants like this:
"String" 34 0xBB 012 "more text"
Numbers are always interpreted in hex, no cap. In that example above, 34 is interpreted as 0x34. The prefix 0x isn't really needed: we could type BB instead of 0xBB. And 012 is interpreted as 0x12, not as an octal number. ๐
Here's the full rundown of actions tied to each key that Midnight Commander handles in the internal file viewer:
F1โ Invoke the built-in hypertext help viewer.F2โ Toggle the wrap mode.F4โ Toggle the hex mode.F5โ Goto. You can specify a line number, offset or percentage of file size of position that you want to view.F7,/,?โ Start search. These keys call the dialog window that lets you set up the search options. If the key is?the "Backwards" option is on.C-sโ Continue forward search.C-rโ Continue reverse search.F17,nโ Continue search in the chosen direction.Nโ Temporary change the search direction: backwards if forward search is chosen, and vice versa.F8โ Toggle Raw/Parsed mode: this will show the file as found on disk, or if a processing filter has been specified in themc.ext.inifile, then the output from the filter. Current mode is always the other one than what's written on the button label, since on the button is the mode which you enter by that key.F9โ Toggle the format/unformat mode: when format mode is on, the viewer will interpret some string sequences to show bold and underline with different colors. Also, the button label shows the other mode than the current one.F10,Esc.โ Exit the internal file viewer.PageDown,space,C-v.โ Scroll one page forward.PageUp,Alt-v,C-b,Backspace.โ Scroll one page backward.Downโ Scroll one line forward.Upโ Scroll one line backward.C-lโ Refresh the screen.C-oโ Switch to the subshell and show the command screen.[n] mโ Set the mark n.[n] rโ Jump to the mark n.C-fโ Jump to the next file.C-bโ Jump to the previous file.Alt-rโ Toggle the ruler.Alt-eโ to change charset of displayed text may useAlt-e(M-e). Recoding is made from selected codepage into system codepage. To cancel the recoding you may select"<No translation>"in the charset selection dialog.
It's possible to instruct the file viewer how to display a file โ look at the Edit Extension File section. ๐
Internal File Editor โจ
The internal file editor is a full-featured full screen editor. It can edit files up to 64 megabytes. It is possible to edit binary files. The internal file editor is invoked using F4 if the use_internal_edit option is set in the initialization file.
The features it presently supports are: block copy, move, delete, cut, paste; key for key undo; pull-down menus; file insertion; macro commands; regular expression search and replace; S-arrow text highlighting (if supported by the terminal); insert-overwrite toggle; word wrap; autoindent; tunable tab size; syntax highlighting for various file types; and an option to pipe text blocks through shell commands like indent and ispell. ๐ซถ
Sections:
- Options of editor in ini-file
The editor is very easy to use and requires no tutoring. To see what keys do what, just consult the appropriate pull-down menu. Other keys are: Shift movement keys do text highlighting. C-Ins copies to the file mcedit.clip and S-Ins pastes from mcedit.clip. S-Del cuts to mcedit.clip, and C-Del deletes highlighted text. Mouse highlighting also works, and you can override the mouse as usual by holding down the shift key while dragging the mouse to let normal terminal mouse highlighting work. ๐ฆ
To define a macro, press C-R and then type out the key strokes you want to be executed. Press C-R again when finished. You can then assign the macro to any key you like by pressing that key. The macro is executed when you press C-A and then the assigned key. The macro is also executed if you press Meta, Ctrl, or Esc and the assigned key, provided that the key is not used for any other function. Once defined, the macro commands go into the file ~/.local/share/mc/mcedit/mcedit.macros โ you can delete a macro by deleting the appropriate line in this file.
To change charset of displayed text may use Alt-e (M-e). Recoding is made from selected codepage into system codepage. To cancel the recoding you may select "<No translation>" in the charset selection dialog.
F19 will format the currently highlighted block (plain text or C or C++ code or another). This is controlled by the file /usr/share/mc/edit.indent.rc which is copied to ~/.local/share/mc/mcedit/edit.indent.rc in your home directory the first time you use it.
The editor also displays non-us characters (160+). When editing binary files, you should set display bits to 7 bits in the options menu to keep the spacing clean. ๐
Options of editor in ini-file ๐
Some editor options of ini-file are described in this section. Options are placed in [Midnight-Commander] section.
editor_wordcompletion_collect_entire_fileโ Search autocomplete candidates in entire of file or just from begin of file to cursor position (0).
Screen selector ๐
Midnight Commander supports running many internal modules (such as editor, viewer and diff viewer) simultaneously and switching between them without closing open files. Using several file managers at a time, however, is not currently supported. ๐ญ
Let's call each of these modules a screen. There are three ways to switch between screens, using one of these global shortcuts:
Alt-}โ switch to the next screen;Alt-{โ switch to the previous screen;- `Alt-`` โ open a dialog window with the list of currently open screens (or use the "Screen list" menu item).
Completion ๐
Let Midnight Commander type for you. Bestie behavior fr fr.
Attempt to perform completion on the text before current position. MC attempts completion treating the text as variable (if the text begins with $), username (if the text begins with ~), hostname (if the text begins with @) or command (if you are on the command line in the position where you might type a command โ possible completions then include shell reserved words and shell built-in commands as well) in turn. If none of these matches, filename completion is attempted.
Filename, username, variable and hostname completion works on all input lines, command completion is command line specific. If the completion is ambiguous (there are more different possibilities), MC beeps and the following action depends on the setting of the Complete: show all option in the Configuration dialog. If it is enabled, a list of all possibilities pops up next to the current position and you can select with the arrow keys and Enter the correct entry. You can also type the first letters in which the possibilities differ to move to a subset of all possibilities and complete as much as possible. If you press Alt-Tab again, only the subset will be shown in the listbox, otherwise the first item which matches all the previous characters will be highlighted. As soon as there is no ambiguity, dialog disappears, but you can hide it by canceling keys Esc, F10 and left and right arrow keys. If Complete: show all is disabled, the dialog pops up only if you press Alt-Tab for the second time โ for the first time MC just beeps. ๐
Apply escaping of ?, *, and & symbols (as \?, \*, and \&) in filenames to disallow use them as metasymbols in regular expressions when substitution is performed in the input line.
Virtual File System ๐ธ
Midnight Commander is provided with a code layer to access the file system; this code layer is known as the virtual file system switch. The virtual file system switch allows Midnight Commander to manipulate files not located on the Unix file system.
Currently, Midnight Commander is packaged with some Virtual File Systems (VFS): the local file system, used for accessing the regular Unix file system; the ftpfs, used to manipulate files on remote systems with the FTP protocol; the tarfs, used to manipulate tar and compressed tar files; the undelfs, used to recover deleted files on ext2 file systems (the default file system for Linux systems), shell (for manipulating files over shell connections such as rsh and ssh). If the code was compiled with sftpfs (for manipulating files over SFTP connections). โจ
A generic extfs (EXTernal virtual File System) is provided in order to easily expand VFS capabilities using scripts and external software.
The VFS switch code will interpret all of the path names used and will forward them to the correct file system โ the formats used for each one of the file systems is described later in their own section.
FTP File System ๐ฅ
The FTP File System (ftpfs) allows you to manipulate files on remote machines. To actually use it, you can use the FTP link item in the menu or directly change your current directory using the cd command to a path name that looks like this:
ftp://[!][user[:pass]@]machine[:port]/[remote-dir]
The user, port and remote-dir elements are optional. If you specify the user element, Midnight Commander will login to the remote machine as that user, otherwise it will use anonymous login or the login name from the ~/.netrc file. The optional pass element is the password used for the connection. Using the password in the VFS directory name is not recommended, because it can appear on the screen in clear text and can be saved to the directory history. ๐
To enable using FTP proxy, prepend ! (an exclamation sign) to the hostname.
Examples:
ftp://ftp.nuclecu.unam.mx/linux/local
ftp://tsx-11.mit.edu/pub/linux/packages
ftp://!behind.firewall.edu/pub
ftp://guest@remote-host.com:40/pub
ftp://miguel:xxx@server/pub
Please check the Virtual File System dialog box for ftpfs options. ๐ซถ
๐ Tar File System ๐
Okay so bestie, the tar file system hands you read-only access to your tar files and your compressed tar files, and the way you get in is with the chdir command. To bounce your directory into a tar file, you change your current directory to the tar file using this syntax, no cap:
/filename.tar/utar://[dir-inside-tar]
And the mc.ext.ini file already ships a shortcut for tar files, which means usually you literally just point at a tar file and hit return to step inside it ๐ซถ โ go check the Edit Extension File section for the deets on how that's done.
Examples, because we love a concrete demonstration:
mc-3.0.tar.gz/utar://mc-3.0/vfs
/ftp/GCC/gcc-2.7.0.tar/utar://
That second one specifies the full path of the tar archive. Periodt.
๐ FIle transfer over SHell filesystem ๐
The shell file system is a network based file system that lets you manipulate files on a remote machine like they were local, which is giving main character energy fr fr. To use it, the other side has to have a bash-compatible shell.
To connect to a remote machine, you just need to chdir into a special directory whose name is in this format:
sh://[user@]machine[:options]/[remote-dir]
The user, options and remote-dir elements are all optional. If you specify the user element, Midnight Commander will try to login on the remote machine as that user โ otherwise it just uses your login name ๐
.
The available options are:
'C'โ use compression.'r'โ usershinstead ofssh.portโ specify the port used by remote server.
If the remote-dir element is present, your current directory on the remote machine gets set to that one. Simple as.
Examples:
sh://onlyrsh.mx:r/linux/local
sh://joe@want.compression.edu:C/private
sh://joe@noncompressed.ssh.edu/private
sh://joe@somehost.ssh.edu:2222/private
๐ฆ SFTP (SSH File Transfer Protocol) filesystem ๐ฆ
The SFTP file system is a network based file system that lets you manipulate files on a remote machine as if they were local. Same vibe, different protocol, iconic behavior honestly.
To connect to a remote machine, you just chdir into a special directory named like this:
sftp://[user@]machine:[port]/[remote-dir]
The user, port and remote-dir elements are optional. If you specify the user element, Midnight Commander will try to login on the remote machine as that user, otherwise it will use your login name. The port specifies the port used by remote server โ 22 by default. And if the remote-dir element is present, your current directory on the remote machine will be set to this one. Obsessed with the consistency tbh.
Examples:
sftp://onlyrsh.mx/linux/local
sftp://joe:password@want.compression.edu/private
sftp://joe@noncompressed.ssh.edu/private
sftp://joe@somehost.ssh.edu:2222/private
When establishing the connection, the server key fingerprint is verified using the ~/.ssh/known_hosts file. If the host/key pair is not found, or the host is found but the key doesn't match, an appropriate message is shown. There are three buttons in that message dialog:
[Yes]โ add new host/key pair to the~/.ssh/known_hostsfile and continue.[Ignore]โ do not add new host/key pair to the~/.ssh/known_hostsfile, but continue nevertheless (at you own risk ๐ญ).[No]โ abort connection.
Ngl, that "at you own risk" is doing a lot of heavy lifting. Read it. Believe it.
๐ Undelete File System ๐
On Linux systems, if you asked configure to use the ext2fs undelete facilities, you'll have the undelete file system available to you. Recovery of deleted files is only available on ext2 file systems โ sorry to the ext3/ext4 girlies, that's just the rules. The undelete file system is just an interface to the ext2fs library to retrieve all of the deleted files names on an ext2fs and provides and to extract the selected files into a regular partition.
To use this file system, you have to chdir into the special file name formed by the "undel://" prefix and the file name where the actual file system resides.
For example, to recover deleted files on the second partition of the first SCSI disk on Linux, you would use the following path name:
undel://sda2
It may take a while for the undelfs to load the required information before you start browsing files there โ so like, be patient bestie, it's loading ๐ง.
โจ EXTernal File System โจ
extfs allows you to integrate numerous features and file types into GNU Midnight Commander in an easy way, by writing scripts. Chef's kiss, genuinely.
Extfs filesystems can be divided into two categories:
- Stand-alone filesystems, which are not associated with any existing file. They represent certain system-wide data as a directory tree. You can invoke them by typing
cd fsname://wherefsnameis an extfs short name (see below). Examples of such filesystems includeaudio(list audio tracks on the CD) orapt(list of all Debian packages in the system).
For example, to list CD-Audio tracks on your CD-ROM drive, type:
cd audio://
- 'Archive' filesystems (like
rpm,patchfsand more), which represent contents of a file as a directory tree. It can consist of 'real' files compressed in an archive (urar,rpm) or virtual files, like messages in a mailbox (mailfs) or parts of a patch (patchfs). To access such filesystems,fsname://should be appended to the archive name. Note that the archive itself can be on another vfs.
For example, to list contents of a zip archive documents.zip, type:
cd documents.zip/uzip://
In many aspects, you could treat extfs like any other directory. For instance, you can add it to the hotlist or change to it from directory history. An important limitation is that you cannot invoke shell commands inside extfs, just like any other non-local VFS. So don't try it, it's not gonna work, and that's on purpose ๐
.
Common extfs scripts included with Midnight Commander are:
aโ access'A:'DOS/Windows diskette (cd a://).aptโ front end to Debian's APT package management system (cd apt://).audioโ audio CD ripping and playing (cd audio://orcd device/audio://).bppโ package of Bad Penguin GNU/Linux distribution (cd file.bpp/bpp://).debโ package of Debian GNU/Linux distribution (cd file.deb/deb://).dpkgโ Debian GNU/Linux installed packages (cd deb://).hp48โ view and copy files to/from a HP48 calculator (cd hp48://).lslRโ browsing oflslRlistings as found on many FTPs (cd filename/lslR://).mailfsโ mbox-style mailbox files support (cd mailbox/mailfs://).patchfsโ extfs to handle unified and context diffs (cd filename/patchfs://).rpmโ RPM package (cd filename/rpm://).rpmsโ RPM database management (cd rpms://).ulha,urar,uzip,uzoo,uar,uhaโ archivers (cd archive/xxxx://wherexxxxis one of:ulha,urar,uzip,uzoo,uar,uha).
You could bind file type/extension to specified extfs as described in the Edit Extension File section. Here is an example entry for Debian packages:
regex/.deb$
Open=%cd %p/deb://
Slay. Next part's coming, don't go anywhere ๐
๐ Colors ๐
Okay bestie, so Midnight Commander is gonna try to detect whether your terminal supports color, using the terminal database and your terminal name. Iconic of it. But sometimes it gets confused (relatable honestly ๐ญ), so you can force color mode or yeet color mode entirely with the -c and -b flags respectively.
If the program is compiled with the S-Lang screen manager instead of ncurses, it'll also peek at the COLORTERM variable, and if that's set, it has the same effect as the -c flag. โจ
You can also hard-declare terminals that should always force color mode by adding the color_terminals variable to the Colors section of the initialization file. This stops Midnight Commander from even trying to detect your terminal's color support. Example:
[Colors]
color_terminals=linux,xterm
color_terminals=terminal-name1,terminal-name2...
The program can be compiled with both ncurses and S-Lang, but heads up: ncurses does not give you a way to force color mode โ ncurses just uses the info in the terminal database. No notes. ๐
Midnight Commander gives you a way to change the default colors. Currently the colors are configured with the environment variable MC_COLOR_TABLE or the Colors section in the initialization file.
In the Colors section, the default color map gets loaded from the base_color variable. You can specify an alternate color map for a terminal by using the terminal name as the key in this section. Example:
[Colors]
base_color=
xterm=menu=magenta:marked=,magenta:markselect=,red
The format for the color definition is:
<keyword>=<fgcolor>,<bgcolor>,<attributes>:<keyword>=...
The colors are optional, and the keywords are: normal, selected, disabled, marked, markselect, errors, input, inputmark, inputunchanged, commandlinemark, reverse, gauge, header, inputhistory, commandhistory. Button bar colors are: bbarhotkey, bbarbutton. Status bar color: statusbar. Menu colors are: menunormal, menusel, menuhot, menuhotsel, menuinactive. Dialog colors are: dnormal, dfocus, dhotnormal, dhotfocus, dtitle. Error dialog colors are: errdfocus, errdhotnormal, errdhotfocus, errdtitle. Help colors are: helpnormal, helpitalic, helpbold, helplink, helpslink, helptitle. Viewer colors are: viewnormal, viewbold, viewunderline, viewselected. Editor colors are: editnormal, editbold, editmarked, editwhitespace, editnonprintable, editlinestate. Popup menu colors are: pmenunormal, pmenusel, pmenutitle.
header decides the color of the panel header โ that's the line with the column titles and the sort mode indicator.
input decides the color of input lines used in query dialogs.
gauge decides the color of the filled part of the progress bar (the gauge), which shows the user how far along file operations like copying are. ๐ซถ
disabled decides the color of a widget that cannot be selected.
The dialog boxes use these colors: dnormal for the normal text, dfocus for the currently selected component, dhotnormal to differentiate the hotkey color in normal components, and dhotfocus for the highlighted color in the currently selected component.
Menus use the same scheme but with the menunormal, menusel, menuhot, menuhotsel and menuinactive tags instead.
Help uses these: helpnormal for normal text, helpitalic for text that's emphasized in italic in the manual page, helpbold for text emphasized in bold in the manual page, helplink for not-selected hyperlinks and helpslink for the selected hyperlink.
Popup menu uses these: pmenunormal for non-selected menu items and as the main color of the popup menu window, pmenusel for the selected menu item, pmenutitle for the popup menu title.
The possible colors are: black, gray, red, brightred, green, brightgreen, brown, yellow, blue, brightblue, magenta, brightmagenta, cyan, brightcyan, lightgray and white. And there's a special keyword for transparent background โ it's 'default'. 'default' can only be used for background color. Another special keyword "base" means mc's main colors. When 256 colors are available, they can be specified either as color16 to color255, or as rgb000 to rgb555 and gray0 to gray23. Example:
[Colors]
base_color=normal=white,default:marked=magenta,default
Attributes can be any of bold, italic, underline, reverse and blink, appended with a plus sign if you want more than one. The special word "none" means no attributes, without attempting to fall back to base_color. Example:
menuhotsel=yellow;black;bold+underline
๐ Skins ๐
You can change how Midnight Commander looks. To do this you gotta specify a file that contains descriptions of colors and the lines used to draw boxes. Redefining the colors is entirely compatible with the assignment of colors, as described in the Colors section. ๐
If your skin contains any true-color definitions, you should define the 'truecolors' key set to TRUE value in the [skin] section. If true-color isn't used but 256-color is, you should define '256colors' instead.
A skin-file is searched with the following algorithm (stopping at the first one found):
- command line option
-S <skin>or--skin=<skin> - Environment variable
MC_SKIN - Parameter
skinin section[Midnight-Commander]in config file. - File
/etc/mc/skins/default.ini - File
/usr/share/mc/skins/default.ini
The command line option, environment variable and parameter in the config file may contain the absolute path to the skin-file (with the extension .ini or without it). Search of skin-file will occur in (stopping at the first one found):
~/.local/share/mc/skins//etc/mc/skins//usr/share/mc/skins/
For getting extended info, refer to:
- Description of section and parameters
- Color pair definitions
- Color and attribute aliases
- Draw lines
- Compatibility
โจ Description of section and parameters โจ
Section [skin] contains metainfo for the skin-file. Parameter description contains a short text about the skin.
Section [filehighlight] contains descriptions of color pairs for filenames highlighting. Names of parameters must be equal to names of sections in the filehighlight.ini file. See Filenames Highlight for getting more info.
Section [core] describes the elements that are used everywhere.
_default_โ Default color pair. Used in all other sections if they don't contain color definitionsselectedโ cursormarkedโ selected datamarkselectโ cursor on selected datagaugeโ color of the filled part of the progress barinputโ color of input lines used in query dialogsinputmarkโ color of input selected textinputunchangedโ color of input text before first modification or cursor movementcommandlinemarkโ color of selected text in command linereverseโ reverse color
Section [dialog] describes the elements that are placed on dialog windows (except error dialogs).
_default_โ Default color for this section. Uses[core]._default_if not specifieddfocusโ Color of active element (in focus)dhotnormalโ Color of hotkeysdhotfocusโ Color of hotkeys in focused element
Section [error] describes the elements that are placed on error dialog windows.
_default_โ Default color for this section. Uses[core]._default_if not specifiederrdhotnormalโ Color of hotkeyserrdhotfocusโ Color of hotkeys in focused element
Section [menu] describes the elements that are placed in the menu. This section describes the system menu (called by F9) and user-defined menus (called by F2 in panels and by F11 in editor).
_default_โ Default color for this section. Uses[core]._default_if not specifiedentryโ Color of menu itemsmenuhotโ Color of menu hotkeysmenuselโ Color of active menu item (in focus)menuhotselโ Color of menu hotkeys in focused menu itemmenuinactiveโ Color of inactive menu
Section [help] describes the elements that are placed on the help window.
_default_โ Default color for this section. Uses[core]._default_if not specifiedhelpitalicโ Color pair for element with italic attributehelpboldโ Color pair for element with bold attributehelplinkโ Color of linkshelpslinkโ Color of active link (on focus)
Section [editor] describes the colors of elements placed in the editor.
_default_โ Default color for this section. Uses[core]._default_if not specifiededitboldโ Color pair for element with bold attributeeditmarkedโ Color of selected texteditwhitespaceโ Color of tabs and trailing spaces highlightingeditlinestateโ Color for line state area
Section [viewer] describes the colors of elements placed in the viewer.
viewunderlineโ Color pair for element with underline attribute
๐ Color pair definitions ๐
Any parameter in a skin-file contains a definition of a color pair.
Color pairs are described as two colors and the optional attributes separated by ';'. First field sets the foreground color, second field sets the background color, third field sets the attributes. Any of the fields may be omitted โ in that case the value will be taken from the default color pair (the global color pair or from the default color pair of this section).
Example:
[core]
# green on black
_default_=green;black
# green (default) on blue
selected=;blue
# yellow on black (default)
# underlined yellow on black (default)
marked=yellow;;underline
Possible colors (names) and attributes are described in the Colors section.
๐ฆ Color and attribute aliases ๐ฆ
This optional section might define aliases for single colors (not color pairs) as well as combinations of attributes โ in other words, for semicolon-separated fragments of parameters. Aliases can refer to other aliases as long as they don't form a loop. ๐
Example:
[aliases]
myfavfg=green
myfavbg=black
myfavattr=bold+italic
[core]
_default_=myfavfg;myfavbg;myfavattr
โจ Draw lines โจ
So this whole thing is about the [Lines] section in your skin-file ๐
By default you get plain ol' single lines, but bestie you can absolutely redefine it to use any utf-8 symbols you want (like, literal line-drawing characters, for example). Go off ๐
WARNING!!! When you build Midnight Commander with thencursesscreen library, the drawing-lines situation is limited! You can only draw single lines. For all questions and comments, please contact the developers ofncurses. Not us. Them. ๐ญ
Here's the rundown of the [Lines] parameters, bestie:
lefttopโ left-top line fragment.righttopโ right-top line fragment.centertopโ down branch of horizontal linecenterbottomโ up branch of horizontal lineleftbottomโ left-bottom line fragment.rightbottomโ right-bottom line fragment.leftmiddleโ right branch of vertical linerightmiddleโ left branch of vertical linecentermiddleโ cross of lineshorizโ horizontal linevertโ vertical linethinhorizโ thin horizontal linethinvertโ thin vertical line
๐ Compatibility
Assigning color via skin-files is fully compatible with the assigning of the colors described back in the Colors section. No drama, they play nice ๐ซถ
And in that case? Reassignment of colors has priority over the skin file, and it's complementary. So yeah, your manual color overrides are the main character here ๐
๐ฆ Filenames Highlight
The [filehighlight] section in your current skin-file is where key names live as highlight groups, and values live as color pairs. Color pairs are documented in the Skins section (iykyk).
The actual rules of filenames highlight are placed in the /usr/share/mc/filehighlight.ini file (or ~/.config/mc/filehighlight.ini). The name of the section in this file must be equal to the parameter names in the [filehighlight] section (in your current skin-file). Matchy matchy, no cap ๐
Keys in these groups are:
typeโ file type. If present, all other options are ignored.regexpโ regular expression. If present, the'extensions'option is ignored.extensionsโ list of extensions of files. Separated by';'sign.extensions_caseโ (only makes sense with the'extensions'parameter) makes the'extensions'rule case sensitive (true) or not (false).
The 'type' key may have these values:
FILE(all files)FILE_EXE
DIR(all directories)LINK_DIR
LINK(all links except stale link)HARDLINKSYMLINK
STALE_LINKDEVICE(all device files)DEVICE_BLOCKDEVICE_CHAR
SPECIAL(all special files)SPECIAL_SOCKETSPECIAL_FIFOSPECIAL_DOOR
๐ Special Settings
Okay so most Midnight Commander settings can be changed straight from the menus, easy peasy ๐ธ BUT there are a small number of settings that can only be changed by editing the setup file. Sneaky little things.
These variables may be set in your ~/.config/mc/ini file:
clear_before_execโ By default, Midnight Commander clears the screen before executing a command. If you would prefer to see the output of the command at the bottom of the screen, edit your~/.config/mc/inifile and change the value of the fieldclear_before_execto0.confirm_view_dirโ If you pressF3on a directory, normally MC enters that directory. If this flag is set to1, then MC will ask for confirmation before changing the directory if you have files tagged.ftpfs_retry_secondsโ This value is the number of seconds Midnight Commander will wait before attempting to reconnect to an FTP server that has denied the login. If the value is zero, the login will no be retried.max_dirt_limitโ Specifies how many screen updates can be skipped at most in the internal file viewer. Normally this value is not significant, because the code automatically adjusts the number of updates to skip according to the rate of incoming keystrokes. However, on very slow machines or terminals with a fast keyboard auto repeat, a big value can make screen updates too jumpy. It seems that settingmax_dirt_limitto10causes the best behavior, and that is the default value.mouse_move_pages_viewerโ Controls if scrolling with the mouse is done by pages or line by line on the internal file viewer.only_leading_plus_minusโ Allow special treatment for'+','-','*'in the command line (select, unselect, reverse selection) only if the command line is empty. You don't need to quote those characters in the middle of the command line. On the other hand, you cannot use them to change selection when the command line is not empty.alternate_plus_minusโ If true, use'+','-','\'and'*'keys normally. For select/unselect, use'Alt-+','Alt--'and'Alt-*'.show_output_starts_shellโ This variable only works if you are not using the subshell support. When you use theC-okeystroke to go back to the user screen, if this one is set, you will get a fresh shell. Otherwise, pressing any key will bring you back to Midnight Commander.timeformat_recentโ Change the time format used to display dates less than 6 months from now. Seestrftimeordateman page for the format specification. If this option is absent, defaulttimeformatis used.timeformat_oldโ Change the time format used to display dates older than 6 months from now or for dates in the future. Seestrftimeordateman page for the format specification. If this option is absent, defaulttimeformatis used.torben_fj_modeโ If this flag is set, then thehomeandendkeys will work slightly different on the panels. Instead of moving the selection to the first and last files in the panels, they will act as follows: Thehomekey will: Go up to the middle line, if below it; else go to the top line unless it is already on the top line, in this case it will go to the first file in the panel. Theendkey has a similar behavior: Go down to the middle line, if over it; else go to the bottom line unless you already are at the bottom line, in such case it will move the selection to the last file name in the panel.use_file_to_guess_typeโ If this variable is on (the default) it will spawn thefilecommand to match the file types listed on themc.ext.inifile.xtree_modeโ If this variable is on (default is off) when you browse the file system on a Tree panel, it will automatically reload the other panel with the contents of the selected directory.shell_directory_timeoutโ This variable holds the lifetime of a directory cache entry in seconds. The default value is900seconds.clipboard_storeโ This variable contains path (with options) to the external clipboard utility like'xclip'to read text into X selection from file. For example:
clipboard_store=xclip -i
clipboard_pasteโ This variable contains path (with options) to the external clipboard utility like'xclip'to print the selection to standard out. For example:
clipboard_paste=xclip -o
autodetect_codesetโ This option allows use the'enca'command to autodetect codeset of text files in internal viewer and editor. List of valid values can be obtain by the'enca --list languages | cut -d : -f1'command. Option must be located in the[Misc]section.
For example:
autodetect_codeset=russian
๐ง Parameters for external editor or viewer
Midnight Commander provides a way for specify an options for external editors and viewers ๐ MC tries to search the "[External editor or viewer parameters]" section in the system initialization file (the mc.lib file located in Midnight Commander's library directory) and then in the ~/.config/mc/ini file. The option name should be equal to the name (full pathname) of the external editor or viewer. The option value can contain following variables:
%filenameโ The filename to edit/view.%linenoโ The start line in the opening file.
For example:
[External editor or viewer parameters]
vi=%filename +%lineno
joe=%filename +%lineno
more=%filename +%lineno
Start line is passed to the external editor/viewer only if it is called from the Find file results window. Periodt.
If external editor/viewer is launched via F4/F3 keys, MC hopes that program (at least "joe", but probably others too) has an own feature that by default opens the file where it was last open. MC doesn't prevent external editor/viewer to save and restore position in opened files. Let them cook ๐
โญ Terminal databases
Midnight Commander provides a way to fix your system terminal database without requiring root privileges. No sudo needed bestie, we love to see it ๐
MC searches in the system initialization file (the mc.lib file located in Midnight Commander's library directory) and in the ~/.config/mc/ini file for the section "terminal:your-terminal-name" and then for the section "terminal:general". Each line of the section contains a key symbol that you want to define, followed by an equal sign and the definition for the key. You can use the special \e form to represent the escape character and the ^x to represent the control-x character.
The possible key symbols are:
f0tof20โ Function keys f0-f20bsโ backspacehomeโ home keyendโ end keyupโ up arrow keydownโ down arrow keyleftโ left arrow keyrightโ right arrow keypgdnโ page down keypgupโ page up keyinsertโ the insert characterdeleteโ the delete charactercompleteโ to do completion
For example, to define the key insert to be the Escape + [ + O + p, you set this in the ini file:
insert=\e[Op
Also now you can use extended learn keys. For example:
ctrl-alt-right=\e[[1;6C
ctrl-alt-left=\e[[1;6D
This means that ctrl+alt+left sends a \e[[1;6D escape sequence and therefore Midnight Commander interprets "\e[[1;6D" as C-Alt-Left. Ate ๐
The complete key symbol represents the escape sequences used to invoke the completion process. This is invoked with Alt-tab, but you can define other keys to do the same work (on those keyboard with tons of nice and unused keys everywhere). Go wild, icon ๐
๐ FILES ๐
okay so bestie, heads up: the full paths down here can vary between installations, and they're also affected by the MC_DATADIR environment variable. If it's set, its value gets used instead of /usr/share/mc in the paths below. iykyk ๐
/usr/share/mc/help/mc.hlp
The help file for the program. literally the built-in help, that's it, that's the file ๐ซถ
/usr/share/mc/mc.ext.ini
The default system-wide extensions file.
~/.config/mc/mc.ext.ini
User's own extension, view configuration and edit configuration file. They override the contents of the system wide files if present.
/etc/mc/mc.iniand/usr/share/mc/mc.ini
System-wide setup files for Midnight Commander, used only if the user doesn't have his own ~/.config/mc/ini file. If /etc/mc/mc.ini exists, /usr/share/mc/mc.ini isn't used.
/usr/share/mc/mc.lib
Global settings for Midnight Commander. Settings in this file affect all users, whether they have ~/.config/mc/ini or not. Currently, only terminal settings are loaded from mc.lib.
~/.config/mc/ini
User's own setup. If this file is present then the setup is loaded from here instead of the system-wide startup file. your config, your rules, slay โจ
/usr/share/mc/hints/mc.hint
This file contains the hints displayed by the program.
/usr/share/mc/mc.menu
This file contains the default system-wide applications menu.
~/.config/mc/menu
User's own application menu. If this file is present it is used instead of the system-wide applications menu.
~/.cache/mc/Tree
The directory list for the directory tree and tree view features.
~/.local/share/mc.menu
Local user-defined menu. If this file is present, it is used instead of the home or system-wide applications menu.
To change the default root directory of MC, you can use the MC_PROFILE_ROOT environment variable. The value of MC_PROFILE_ROOT must be an absolute path. If MC_PROFILE_ROOT is unset or empty, the HOME variable is used. If HOME is unset or empty, MC directories are get from the GLib library. no cap ๐
๐ LICENSE ๐
This program is distributed under the terms of the GNU General Public License as published by the Free Software Foundation. See the built-in help for details on the License and the lack of warranty. (yes bestie, "lack of warranty" โ read the built-in help, fr fr ๐)
๐ AVAILABILITY ๐
The latest version of this program can be found at http://ftp.midnight-commander.org/. go get the freshest build, queen ๐
๐ SEE ALSO ๐
ed(1), gpm(1), terminfo(1), view(1), sh(1), bash(1), tcsh(1), zsh(1).
Midnight Commander's page on the World Wide Web:
https://www.midnight-commander.org/
the whole squad is linked up in here ๐
๐ AUTHORS ๐
Authors and contributors are listed in the AUTHORS file in the source distribution. iconic behavior from everyone involved, honestly ๐
๐ BUGS ๐
See the file TODO in the distribution for information on what remains to be done. (yes it's literally called TODO, we're all works in progress ๐ธ)
If you want to report a problem with the program, please create a bugreport at https://www.midnight-commander.org/.
bestie when you file that report, please give us: - a detailed description of the bug, - the version of the program you are running (mc -V displays this information), - the operating system you are running the program on. And if the program crashes, we would really appreciate a stack trace. ๐ซถ that's the whole thing, that's all we need.
and that's a wrap on the whole mc(1) page, bestie!! ๐ this one came from MC Version 4.8.33, dated January 2025, and it's the MC(1) manual page โ you just read all 15 parts of it, main character energy fr. go open a terminal and slay some file management. periodt. ๐
โจ๐ฆ
๐ฆ where this page comes from
- alpine 3.22: mc-doc 4.8.33-r2 ยท GPL-3.0-or-later
- alpine 3.23: mc-doc 4.8.33-r2 ยท GPL-3.0-or-later
- alpine 3.24: mc-doc 4.8.33-r3 ยท GPL-3.0-or-later
- arch rolling: mc 4.8.33-1 ยท GPL-3.0-or-later
- debian trixie: mc-data 3:4.8.33-1+deb13u1 ยท GPL-3.0-or-later
- ubuntu questing: mc-data 3:4.8.33-1.1
- ubuntu resolute: mc-data 3:4.8.33-1.1build1 ยท GPL-3.0-or-later
- ubuntu stonking: mc-data 3:4.8.33-1.1build1 ยท GPL-3.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms