Install mc (midnight commander)

From OpenFSG

Jump to: navigation, search

Contents

About GNU Midnight Commander (mc)

Being a text mode application, GNU Midnight Commander can be used locally or remotely, on the console or under X Window System. By using full screen space of the terminals, it provides an intuitive user interface to the operating system, aiming to be a useful tool for users with any level of experience, from a newbie to a guru.

Info

I have installed mc on the FSG with firmware 3.3.9 but it should work on other firmware versions as well.

Windows users: it is recommended to use the ssh client PuTTY found at [1] (or another advanced ssh client) to access the ssh server, due to it's colour support and it's mouse support. A cygwin ssh will not support colour or mouse.

Mac OS X users: you can use the built-in OS X terminal without a problem. Simply open your terminal and type "ssh -l admin [IP NUMBER]". The Mac OS X terminal does not support a mouse.

For more information then please look at the Wikipedia page.

Note: The helpfile in mc isn't included for some reason, but a workaround to download it is in the Issues section.

Installing Midnight Commander

Before starting, ssh onto the FSG, log in as root and install the Ipkg Installer first. (for more info see official ipkg bootstrap)

The following must be installed as root.

  1. Install Midnight Commander which also installs ncurses: "ipkg install mc"
  2. Install the GLib library of C routines: "ipkg install glib"
  3. If you are using a compatible ssh terminal (PuTTY, for example) then edit /etc/profile to set up your terminal settings. Add the following lines: "export TERMINFO=/opt/share/terminfo" and "export TERM=xterm-color". Use vi, nano (ipkg install nano) to edit and create these configuration files or the command line "cat >> /etc/profile" and a control-C to finish.
  4. If you install mc version 4.5.55-7 or higher you need to install EXT2 Filesystem Utilities with "ipkg install e2fsprogs" or else mc will exit with 'Error while loading shared libraries : libext2fs.so.2 can not open shared object file'
  5. Reboot the FSG: "reboot"
  6. Log in and check if the terminal settings have been added properly: "export"
  7. Start MC for the first time: "mc"
  8. If mc warns about missing files extfs.ini and sfs.ini in /opt/lib/mc/extfs create these files with
mkdir /opt/lib/mc/extfs
touch /opt/lib/mc/extfs/extfs.ini
touch /opt/lib/mc/extfs/sfs.ini

Midnight Commander should now work properly:

Image:mc-colour.jpg

Trick

Edit by Ben (Zanco) 9 april 2008:

If MC does not start but gives the message "mc: not found" try this: "/opt/bin/mc" that worked for me.

MC is installed in the /opt/bin folder and it seems to me that the FSG is assuming that all bin files are in /bin . This way I learned that more packages I installed are in the /opt/bin folder and actually DO work when starting them with /opt/bin "name" (like the nano editor) End of edit.


Example

/ # ipkg update
Downloading http://ipkg.nslu2-linux.org/feeds/optware/fsg3/cross/stable/Packages.gz
Inflating http://ipkg.nslu2-linux.org/feeds/optware/fsg3/cross/stable/Packages.gz
Updated list of available packages in /opt/lib/ipkg/lists/optware
Downloading http://ipkg.nslu2-linux.org/feeds/optware/fsg3/cross/stable/Packages.gz
Inflating http://ipkg.nslu2-linux.org/feeds/optware/fsg3/cross/stable/Packages.gz
Updated list of available packages in /opt/lib/ipkg/lists/cross
Successfully terminated.
/ # ipkg install glib
Installing glib (2.6.6-3) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/fsg3/cross/stable/glib_2.6.6-3_armeb.ipk
Configuring glib
Successfully terminated.
/ # ipkg install mc
Installing mc (4.5.55-6) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/fsg3/cross/stable/mc_4.5.55-6_armeb.ipk
Installing ncurses (5.6-1) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/fsg3/cross/stable/ncurses_5.6-1_armeb.ipk
Configuring mc
Configuring ncurses
Successfully terminated.
/tmp # cat /etc/profile
PATH=$PATH:/opt/bin:/opt/sbin
/tmp # cat >> /etc/profile
export TERMINFO=/opt/lib/terminfo
export TERM=xterm-pcolor

Note: Here I enter a Control-C to finish adding lines to a file

/tmp # cat /etc/profile
PATH=$PATH:/opt/bin:/opt/sbin
export TERMINFO=/opt/lib/terminfo
export TERM=xterm-pcolor


Usage

  • Use your mouse left button to select files and menus and the right mouse button to "mark" bunches of files or directories you want to do things to.
  • You can also use some keyboard shortcuts (essential if you are using cygwin as an ssh terminal since it doesn't support the colour commands above or using the mouse):
  • Use the F-keys to use the menu choices at the bottom of the screen.
  • Use the Up and Down arrows to move up and down the filelist.
  • Use the insert key to select files.
  • Use the " " (not the one on the numpad though) to enter a marking criteria (e.g. *.log) and use the "/" key to enter an unmarking criteria (e.g. donttouch.*).
  • GNU Midnight Commander documentation uses emacs style names for keyboard keys.
    • C stands for the Ctrl key. For example, C-f means that you should hold down the Ctrl key and press the f key.
    • M stands for the Meta key. Your terminal might call it Alt or Compose instead of Meta. For example, M-f means that you should hold down the Meta/Alt/Compose key and press the f key. If your terminal doesn't have Meta, Alt or Compose or they don't work you can use Esc. For M-f press the Esc key and then press the f key.
    • Sometimes Ctrl and Alt are used instead of C and M for simplicity. Keep in mind that Alt can actually be Meta on some keyboards.
  • F? stands for a function key. If your terminal doesn't have function keys or they don't work you can use Esc. For example, for F3 press the Esc key and then press the 3 key.

Issues

  • When using the editor in MC a message "Error in file /home/.users/admin/.cedit/Syntax on line 174" may appear. This does not seem to keep the editor from working though.
  • Large files (2-3 Gb in size) are not being displayed. MC warns with a "the file exists but can not be stat-ed: Value too large for defined data type"
  • The help file is missing when you press F1:
Cannot open file /opt/lib/mc/mc.hlp
No such file or directory (2)

If you want the help file (who wouldn't?) then visit the koder search engine and use the download button in the top left and place it onto your FSG in /opt/lib/mc/mc.hlp.

  • cygwin terminal is only in black and white and doesn't support mouse:

Image:mc-cygwin.jpg

For more up to date info look at the pages of NSLU2-Linux:


Credits to the guys at NSLU2 for their work and info!

Personal tools