nc(1)

NAME
nc - visual shell for Unix-like machines.

FORMAT
nc [-V] [-b] [dir1 [dir2]]

DESCRIPTION

The MouseLess Commander, is a directory browser/file manager for unix-like operating systems. The interface is similar to John Socha's Norton Commander program for DOS.

OPTIONS

-b  Forces black and white display.

-V  Displays the version of the program.

If specified, the first path name is the directory to show in the selected panel; the second path name is the directory shown in the other panel.

Overview
The MouseLess Commander provides a view of two directories at the same time. One of the panels is the current panel (a selection bar is over a directory in the current panel). Almost all operations take place on the current panel. The file operations rename and copy by default perform the operation to the unselected panel (don't worry they allways ask you before).

You can execute system commands from the MouseLess Commander by simply typing them in the command line (this command line is always present at the bottom of the panels) and pressing enter, read the Keys section to learn more about the command line.

Keys
The MouseLess Commander uses the F1-F10 keys to perform special commmands. The escape sequences for the Fkeys are ncurses's kf1 trought kf10. On terminals without function keys support, you can achieve the same functionality by pressing the ESC key and then a number in the range 1 trough 9 and 0 (corresponding to F1 to F10 respectively).

Some commands in the MouseLess Commander involves the use of the Control (sometimes labeled CTRL or CTL) and the Meta key. In this manual we'll use the following abbreviations:

C-<chr> means hold the Control key while typing the character <chr>. Thus C-f would be: hold the Control key and type f.

M-<chr> means hold the Meta or Alt key down while typing <chr>. If there is no Meta or Alt key, type <ESC> release it, the type the character <chr>.

All input lines in the MouseLess Commander use an approximation to Emacs's key bindings.

Here is a listing of the actions associated with each key that the MouseLess Commander handles.

ESC It's used to cancel most input dialogs. It's also used as a prefix for some special commands.

F1 Invokes the built-in hypertext help viewer. Inside the help viewer, you use the tab key to select the next link and the enter key to follow that link. The keys space and backspace are used to move forward and backward in a help page.

F2 Invokes the user menu. The user menu provides an easy way to provide users with a menu.

F3 Views the currently selected file.

F4 Currently it invokes the vi editor or the editor specified in the EDITOR
 environement variable.

F5 Pops up an input dialog that defaults to the directory in the non-selected panel and copies the currently selected file (or the tagged files if there is at least one file tagged) to the directory specified by the user in the input dialog. During the process, you could press C-c or ESC to abort the operation.

F6 Pops up an input dialog that defaults to the directory in the non-selected panel and moves the currently selected file (or the tagged files if there is at least one tagged file) to the directory specified by the user in the input dialog. In the future it'll be possible to make a masked rename. During the process, you could press C-c or ESC to abort the operation.

F7 Pops up an input dialog and creates the directory specified.

F8 Deletes the currently selected file or the tagged files in the currently selected panel. During the process, you could press C-c or ESC to abort the operation.

F9 Activates the pull down menu. See the section on the Menu for more information.

F10 Terminates the MouseLess Commander

Insert, C-t. In order to tag files you may use the Insert key (the kich1 terminfo sequence) or the C-t (Control-t) sequence. To untag files, just retag a tagged file.

M-Enter This sequence copies the currently selected file name to the input line, this is usefull to avoid excesive typing.

M-Tab This sequence copies the currently selected file name in the unselected panel to the input line, also, this is usefull to avoid excesive typing.

M-S

+ (Plus) This is used to select (tag) a group of files. When Shell Patterns are enabled, the regular expresion is much like the regular expressions 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 (see ed (1)).

\\ (backslash) Use the "\" key to unselect a group of files, just like the Plus key.

TAB The TAB is used to switch you between the left and the right panel.

Enter If there is some text in the command line (the one at the bottom of the panels), then that command is executed. If there is no text in the command line then if the selection bar is over a directory the MouseLess Commander does a chdir(2) to the selected directory and reloads the information on the panel; if the selection is an executable file then the selection is executed. Finally, if the extension of the selected file name matches one of the extensions in the extensions file then the corresponding command is executed.

C-q The quote command, use the quote command to insert characters that are otherwise interpreted by the MouseLess Commander (like the +)

up-key, C-p. These keys moves the selection to the previous entry in the panel.

down-key, C-n. These keys moves the selection to the next entry in the panel.

home, a1, M-<. This key moves the selection to the first entry in the panel.

end, c1, M->. These keys moves the selection to the last entry in the panel.

next-page, C-v. This key moves the selection one page down.

prev-page This key moves the selection one page up.

C-l. This repaints all the information in MouseLess Commander.

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, moves the cursor one position left.

C-f, move-right, moves the cursor one position right.

C-h, delete, they destroy the previous character.

C-2. This sets the mark for cutting.

C-w Copies the text between the point and the mark to a kill buffer and removes the text from the input line.

C-y Yanks back the contents of the kill buffer.

C-k Kills the text from the point to the end of the line.

Executing Unix Commands
You may execute commands by typing them directly in the Mouseless' Commander input line or by selecting the program you want to execute with the bar in one of the panels and typing enter.

If you press enter over a file that is not an executable file, the MouseLess Commander checks the extension of the selected file with the extensions in the Extensions File. If a match is found then the code associated with that extension is executed. A very simple macro expansion takes place before executing the command. For more information see the Macro substitution section.

Directory Display
Currently you can choose three different directory displays: the brief display, the full display and the long display . The brief display only shows the file name; the full display shows the file name, the size of the file and the permission bits and the long display output is similar to the output of ls -l. To toggle between those displays you need to change it from the pull down menu.

You may quickly select a file in the current panel by typing M-S and then the file name.

For example, to go directly to the files that start with the 'mu' word you could type: M-S m u.

Program Options
The program has some options that may be toggled on and off from the pull down menu. Options are enabled if they have an asterisk in front of them. These options are:

Show Backup Files. By default the MouseLess Commander doesn't show files ending in '~' (like GNU's ls option -B).

Show Hidden Files. By default the MouseLess Commander will show all files that start with a dot (like ls -a).

Verbose operation. This toggles whenever copy/rename/delete operations are verbose (they display a dialog box for each operation). If you have a slow terminal, you may consider turning off the verbose operation.

Mark moves down. By default when you mark a file (with either C-t or the Insert character) the selection will move down.

Pause after run. After executing your commands you'll be asked to press any key to refresh the screen. This is to let you see the output of your command before continuing. As soon as I figure how does vi do the trick of saving/restoring the original screen I'll get rid of this default.

Show Mini-Status. If enabled it shows a one-line status information at the bottom of the panels about the currently selected item.

Shell Patterns. By default the MouseLess Commander will convert the regular expressions used to select or unselect to shell-like regular expressions. It performs the following conversions: 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 in ed(1).

Auto Save Setup If this option is enabled, when you exit the MouseLess Commander, the configurable options of the MouseLess Commander are saved in the $HOME/.nc.ini file.

Auto menus If this option is enabled, the user menu will be invoked at startup. Usefull for building menus for non-unixers.

Use internal view If this option is enabled, it invokes the build in file viewer (I think it's slow when scrolling one line at a time, if you know how I could speed this up, please tell me). If the option is disabled it invokes the pager specified in the PAGER environement variable. If no pager is specified it invokes the view command.

Mix all files When this option is enabled, all files and directories are shown together. If the options is off, then subdirectories are shown at the beginning of the listing and any other files come after.

Fast directory reload This option is turned off by deafult. If you activate the fast reload, then the MouseLess Commander uses a trick to determine if the directory contents have changed. This trick reloads the directory if the i-node of the directory has changes, this means that if what changes is the i-node for a file in the directory (file size changes, mode changes, owner, etc) the display is not updated. In this cases, when the option is on, you'll have to do a manual reload of the directory.

Clear before exec This options is not present in the pull down menu. By default the MouseLess Commander clears the screen before executing a command. If you would prefer to see the output of the command in the bottom of the screen, edit your init file ~/nc.ini and change the value of the field clear_before_exec to 0.

Setup
At startup the MouseLess commander will try to load initialization information from the $HOME/.nc.ini file. If the file doesn't exist, it will load the information from the system wide configuration file located in /usr/local/lib/nc.ini.

You may save the setup explicitly from the pull down menu or activate the auto save setup option from the pull down menu.

Extension File Edit
This will invoke your editor on the file ~/.nc.ext. The format of this file is as follows: each line specifies an extension and the command associated to that extension. The extension must start at the first column. Everything after the extension is the code executed when you press enter over a file that matches that extension. Simple macro substitution takes place before executing the command.

Here is an example of an extension file:
	.tar.gz	 tar tzvf %f | more
	.tar.Z   tar tzvf %f | more
	.tar     tar tvf %f | more
	.zip     unzip -v %f | more
	.o       nm %f | more
	.a       ar tv %f | more
	.tex     tex %f
	.latex   latex %f
	.dvi     dvips %f

User Menu
The user menu provides an easy menu for the users. When you access the user menu the first of these files is loaded as the user menu:
 ./.nc.menu, ~/.nc.menu, /usr/local/lib/nc.menu.

The format of the menu file is very simple. Lines that start with anything but space or tab is considered an entry for the menu (in order to use it like a hot key the first char should be a letter). All entries are shown to the user. All the lines that start with a space or a tab are the commands that will be executed when the entry is selected.

When an option is selected all the command lines of the option are copied to a temporary file in the temporary directory (usually /usr/tmp) and then that file is executed. This allows the user to use normal shell constructs in the menus. Also simple macro substitution takes place before executing the menu code. For more information, see macro substitution.

Here is a sample nc.menu file:

A	Dumps the currently selected file
	od -c %f
B	Edit a bug report and send it to root
	vi /tmp/mail.$$
	mail root < /tmp/mail.$$
M	Reads mail
	emacs -f rmail
N	Reads Usenet news
	emacs -f gnus
H	Call the info hypertext browser
	info
J	Copies -R . to other panel with tar
	tar cf - . | (cd %D && tar xvpf -)
K	Makes 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

Macro substitution

When accesing a menu or executing an extension dependant command, a very simple macro substitution takes place.

The macros are:

%f

    The currently selected file name.

%d

    The current directory name.

%F

    The file selected in the unselected panel.

%D

    The directory name of the unselected panel.

%%

    The % character

FILES

/usr/local/lib/nc.hlp

    The help file for the program.

/usr/local/lib/nc.ext

    The default extensions file.

/usr/local/lib/nc.ini

    The default setup for the MouseLess Commander.

$HOME/.nc.ini

    If this file is present then the setup is loaded from here instead of the system wide startup file.

/usr/local/lib/nc.menu

    This file contains the applications menu.

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 warranty.

SEE ALSO
ed(1), sh(1), terminfo(1), view(1).

AUTHORS
Miguel de Icaza (miguel@roxanne.nuclecu.unam.mx)

Mauricio Plaza (mok@roxanne.nuclecu.unam.mx).

BUGS
See the file TODO in the distribution for more information on what remains to be done.