With the vast power of the GNU/Linux command line comes an equal amount of complexity. Trying to remember the multitude of commands can be overwhelming at times. As you sit staring at the blackness of your monitor, you wish for an easier way to tame this thing called CLI. Relax all of you GUI addicts, it is now time to introduce you to the wonderful world of Midnight Commander.
Midnight Commander offers an intuitive interface, the ability to view/edit files, mouse support, and built-in support for many Virtual File Systems (VFS). The VFS supported by Midnight Commander include: FTP, for browsing remote FTP repositories; FISH, for manipulating files over shell connections such as rsh and ssh; and SMB, for accessing remote Windows shares. It also includes the ability to browse many GNU/Linux archives such as tar, tgz, bz2, rpm, deb, zip, cpio, lha, rar, and zoo files.
Getting Started.
As of this writing, the current version of Midnight Commander is 4.6.0.
After obtaining the source
code for Midnight Commander, decompress the tarball
and issue the following commands from the CLI:
cd mc-4.6.0
./configure
make
su
<root password>
make install
To start using Midnight Commander type mc on the
command line.
At first glance you will notice that the interface consists of four
distinct sections.
Using the CLI is now as easy as typing on your keyboard. Move the selection bar by using the up/down arrow keys. To enter a directory simply move the selection bar on the directory name and press the Enter key. Likewise, to move up one directory move the selection bar to the "/.." line and press Enter. Browsing the contents of an archive file can be performed by moving the selection bar to highlight the archive and pressing Enter. Do you notice a pattern here?
Manipulating Files.
|
|
| Click to enlarge |
Editing or viewing a file can be done by highlighting the file with the selection bar and pressing either the F3 (view) or F4 (edit) key. Once in view mode you can navigate the file with the up/down arrow keys and the Page Up/Page Down keys.
In edit mode, you can use the same keys as view mode along with the left/right arrow keys to move the cursor through the file. Type as you normally would in any GUI based text editor to make changes to the file. To save the file after editing, press the F2 key.
While in view or edit modes, the Home key moves to the beginning of the file and the End key moves to the end of the file. Press the F10 key to exit either mode.
Menu and Shortcuts.
Both browse and edit modes contain a top menu area. The top menu may be activated by the F9 key. Once activated, you can traverse the menu area using the arrow keys. The Enter key will execute the current menu selection. The Esc key (twice) will deactivate the top menu.
While within the top menu structure you may have noticed keyboard shortcuts for most of the menu items. While using Midnight Commander, you will find these shortcuts extremely useful. Some of the shortcuts may appear unconventional, such as "C-x". Here's an explanation of these shortcuts:
The most common commands used in MC are assigned to the Function keys (F1 - F10). The value of each key is different depending on which mode that you are in. Here is a table of the commands assigned to each of the Function keys in the various modes.
| |
Browse mode | View mode | Edit mode |
| F1 | Displays the main Help screen | Displays the viewer Help screen | Displays the editor Help screen |
| F2 | Activates the User Menu | Wrap/unwraps the text | Saves the file |
| F3 | View the selected file | Exits View mode | Selects text |
| F4 | Edit the selected file | Toggles ascii/hex view mode | Find and Replace |
| F5 | Copy the selected file | Opens the Goto Line dialog | Copy selected text to cursor position |
| F6 | Rename/Move the selected file | Regexp Search | Move selected text to cursor position |
| F7 | Creates a new directory in the active panel | Search | Search |
| F8 | Deletes the selected file | Toggle Raw/parsed mode | Delete the current line or selection |
| F9 | Displays the top menu | Toggles Format/unformat view | Displays editor's top menu |
| F10 | Exits MC | Exits View mode | Exits Edit Mode |
Mouse Support.
Mouse support is available by default when using a terminal emulator, such as rxvt, under X. In order to enable mouse support on the console, you will need to install and run gpm. The mouse cursor will appear as a small, highlighted rectangular area when using MC from the console.
The top menu, function labels, and cursor position can be manipulated by single-clicking with the left mouse button. Entering a directory may be performed by double-clicking. Selecting multiple files (for Copy/Move/Delete) can be done in X by right clicking each file, however, multiple selections from the console must be done using the "C-t" keyboard shortcut.Whether you are a noobie or a seasoned veteran, Midnight
Commander is probably on of the most useful tools for working with the
CLI. MC's ease of use is equally matched by it's vast functionality. To
learn more about using Midnight Commander, consult the man pages (man
mc) and it's built-in Help system.
Note: Comments are owned by the poster. We are not responsible for their content.
<TT>ESC 1</TT>That is the Escape key followed by 1 - and it has the same effect as pressing F1.
Following on from that, ESC 2 for F2, ESC 3 for F3 and so on. ESC 0 (zero) is the same as F10.
This is useful when using mc through ssh and similar and the function keys are not mapped out as you would expect...
You miss Search
Posted by: Anonymous Coward on September 15, 2006 12:58 PMSo the one you whould have put was Ctrl-s for searching and locating a file within the directory. This was definetly a most mention.
#