Midnight Commander / MC Tutorial
|
|
|
Midnight
Commander is a console file manager and directory browser. It is a
friendly system for many tasks in the terminal window, and the quickest
way to copy, move or delete multiple files. MC can also do fast ftp and
network file transfers. Start
Midnight Commander by typing mc in a terminal window. The main section will be the two
directory panels, with a dropdown menu line above, a command line below, and
right underneath a list of the present functions of the F (function) keys. And, above the command line is a Hint line that shows random tips. The Basics: Navigation in the Directory Panels
See Configuration on how to enable 'lynx-like motion'. Without needing to scroll to the top, the back arrrow will change you directly into the parent directory. Keyboard Shortcuts The
'F' keys are widely used in mc for file operations. Read the bar at the bottom
for their
current function, which may differ according to the context,
eg. browsing a directory, using the file viewer, or the editor. Other basic keyboard usages:
Menus Along the top is the drop-down menu bar. F9 highlights the Left / Right menu, then arrow sideways across. (See Configuration to set drop-down menus, so you will not have to Enter to display that menu.) To select a menu item, arrow down and Enter, or use the hotkey - the highlighted letter. Browse through the menus and see what features they offer. A brief overview:
Select Options menu, Configuration. To mark or unmark the boxes, use the Space bar or mouse click. Sometimes, too much fiddling with the configuration messed up my mc – and I couldn't restore it as I didn't know what I had done. No problem – just delete the .mc directory in your home directory, relaunch mc and reconfigure from scratch. The profile is specific to each user. File and Directory Operations Files and directories can be moved, copied, deleted and the contents viewed easily through the F keys - always refer to the options list underneath. If you are moving or copying files, it will assume you are actioning the files to the opposite directory – but always asks you to confirm, giving you the option to change the destination. In the directory panels, select files, single or multiple, by using Insert key to highlight them – and Insert again on any file to unselect. You can filter for multiple files: the + key will bring up a selection box into which you can enter wildcards. For instance, when I had moved a bunch of cartoon files by mistake into my Songs directory, I selected *jpg and it automatically highlighted them all. Then F6, which moved them across to the Cartoons directory on the other side. For more advanced operations, such as changing permissions
or ownership, linking and symlinking, select File menu from the dropdown
menu bar. Enter on your chosen operation, use the highlighted hotkey
or refer to the keyboard shortcut. The command line Although I don't use the
command line much in mc, it should execute whatever you have
typed into it. If you wish to su, it will return you to the
terminal to type in your password. Then relaunch mc as root; if you ctl-o, it will take you back as user. Using the mouse in mc – For click-click fans The mouse works in mc, but the keyboard is handy to know when the battery goes flat in your cordless mouse... From the man page:
The Midnight Commander
comes with mouse support. 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). If a mouse button is clicked on the top frame line of the directory panel, it is scrolled one pageful backward. Correspondingly, a click on the bottom frame line will cause a scroll of one pageful forward. This frame line method works also in the Help Viewer and the Directory Tree.
If you are running the
Commander with the mouse support, you can bypass the Commander
and get the default mouse behavior (cutting and pasting text) by
holding down the Shift key. If your mouse does not work in mc, check that gpm mouse server is installed and running. Accessing Archives
All
sorts of archives - RPM, deb, tgz, iso, rar, cpio etc. are accessible
with mc. The individual files can be viewed and extracted without
needing to unpack or install. Zip
archives can be similarly viewed and files browsed and copied before
unzipping (unzip .zip by command line only - the F2 unzip function only
works with .gz or .bz2 extensions).
Installation of RPM and tgz TGZ: To extract a tarball, F2 for a file user menu,
then x to extract. You can cd to the extracted directory, then ./configure, make and make install from the
command line, as per the INSTALL file instructions (which you read with F3), although there remains the problem of having
to su to root halfway when you start as user.
Editing files with mcedit In mc, open a file to edit with F4. Once finished, F2 to save and F10 to quit (or click quit at the bottom). If it won't save your file, that means you forgot to edit it as root and now you're going to have to su and do it all over again! (Remember to relaunch mc once you are root.) Note the F keys have slightly different uses in the editor - refer to the function bar at the bottom. Mouse highlighting to copy and paste works similarly to the terminal, but use the shift key at the same time: shift, highlight, then shift and paste with the middle button. Or, paste other items on your clipboard with Shift-Insert. Using mc to FTP MC can ftp via the command line, the Left / Right menu, or to a site you have saved in your directory hotlist. Command line: For anonymous sites, the format is cd ftp://ftp.yoursite.com Left / Right dropdown menu: will connect on that respective side. Arrow down to
FTP link, or use hotkey P. A dialog box will request the FTP address in the
same format: For all methods, the username alone can be entered, eg. username@ftp.yoursite.com and and a box will request the password. If you access the site regularly, add it as a 'bookmark' to your directory hotlist
(see Command menu.)
To disconnect ftp, type cd in the command line and it
will return you to your home directory. Networking with Samba In
the same way as with ftp, select Left / Right menu and SMB link (or
hotkey B), and a box will open for the machine name. Or, command-line format:
cd smb://IP.AD.DR.ES/ Advanced users: For a detailed guide by the developers of Midnight Commander, see here. Midnight Commander for Mac: I installed mc using Rudix according to the instructions on Michigan Telephone.
As mentioned earlier, use Ctrl-t in place of the insert key, and Esc -
no. in place of the F keys. The mouse does not work in Terminal. This page uploaded in a flash using Midnight Commander!
|
-
Advice for Newbies
Other Extras: ------------------------------- Independent Cycle Touring in France -------------------------------- Self-Catering Accommodation, Wilderness -------------------------------- ------------------------------- Contact Jane here for more information.
|
|
© Jane Trembath 2010. All rights reserved. / Sitemap |
|