NcFTP(1)

NAME
NcFTP — Internet file transfer program

SYNOPSIS
ncftp [program options] [[open options] hostname [:pathname]]

DESCRIPTION
NcFTP is an alternative user interface to the Internet standard File Transfer Protocol. The program allows a user to transfer files to and from a remote network site. This program offers additional features that are not found in the standard interface, ftp.

FEATURES

•   By default, an anonymous login is attempted when you open a site. No need to enter ``anonymous'' and your email address every time you open a site.

•   You can save some keystrokes by putting commonly used sites in the .netrc file, and then just type abbreviations when you open them on the command line. For example, if you had wuarchive.wustl.edu in your .netrc you would only need to type ``o wuar'' or ``o wustl'' (or any abbreviation that will separate it from the rest of the sites in your .netrc).

•   ncftp can keep a log of sites opened and files transferred for later reference.

•   ncftp has ``implicit cd'' where you can just type the name of a directory (when connected) instead of typing ``cd <directory>''.

•   File transfers use a progress indicator, showing what percentage of the file has been transferred.

•   ncftp has a built in mini-nslookup facility, for finding IP numbers or site names.

•   The ls command works like ``ls -CF''. Some versions of ftp implemented ls exactly like dir (ls -l).

•   A page command lets you use your pager to read remote files. There are also the commands pls and pdir which let you read directory listings with your pager.

•   You don't need to close sites; ncftp closes an open site when you try to open a different one.

•   You can save some typing by using a wildcard to specify one file. For example, you can type ``get R*'' to fetch a file called README.

•   You can invoke ncftp with ``colon mode'' where you can type ``ncftp cse.unl.edu:/pub/foo'' and it will fetch ``foo'' for you then exit.

•   There is a create command which is useful for creating messages on a remote site.

•   ncftp tells you when new mail has arrived.

•   File transfers use a larger buffer, so transfers may be faster.

•   The prompt can be customized to include things like the date, time, current remote working directory, boldface, etc.

•   ncftp can be compiled to log information to the system log.

•   The behavior of ncftp can be customized with set and unset and the .netrc can contain commands to set these variables each time you start up.

OPTIONS

Command line options: Program options follow. Open options are identical to the options given to the open command, described later.

-V  forces ncftp to show all responses from the remote server, as well as report on data transfer statistics.

-N  restrains ncftp from reading the .netrc (see below) file in the user's home directory.

-D  enables debugging.

-H  prints version and compile-time options.

The client host with which ncftp is to communicate may be specified on the command line. If this is done, ncftp will immediately attempt to establish a connection to an FTP server on that host; otherwise, ncftp will enter its command interpreter and await instructions from the user. ncftp uses many of the commands provided by ftp but some old commands will not appear under the main help screen although they are still supported. This was done to avoid overwhelming the user with many commands that do the same thing. Examples of commands that still run but don't show up in the help screen are send, close, bye, and ascii.

COMMANDS
Explanations of commands specific to ncftp follow. Please refer to the manual page for ftp for descriptions of the standard commands.

create
    Use this to create an empty file on the remote site. Sometimes it is necessary to leave a note if you can't get in touch with the remote site's administrator. For example if a file is corrupted, you could type ``create Foo.tar_is_corrupt'' so the uploader will replace it.

lookup
    Use this if you know a site's IP number but want its name, or if you know its name but want its IP number. For example ``lookup cse.unl.edu'' will spit out ``129.93.1.12'' and vice versa.

open
    This command has been extended to accept flags to specify its behavior. By default, ``open sitename'' tries to login to a site with ``anonymous'' and your email address as the password. If you would like to specify a login/password combination (like ftp does by default), use the ``-u'' flag, like ``open -u cse.unl.edu.'' You can also specify the ``-i'' flag if you want to ignore the machine record in your .netrc. Occasionally this is necessary when you have a login/password in the .netrc but you want to use a different login/password combo. ncftp also has a ``redial'' feature, the ``-r'' flag, so if a site is refusing connections you can have the program keep trying until you are connected. You can further customize the redial feature with the ``-d N'' and ``-g N'' flags, which stand for sleep delay and maximum retries respectively. The default sleep delay is 60 seconds. If you omit the ``-g N,'' the program keeps trying no matter how long it takes (or until you hit the interrupt key). This example shows how to poll ftp.unl.edu every ten minutes or until 20 retries is reached: ``open -r -d 600 -g 20 ftp.unl.edu.'' Please be considerate when you use redialing, so you won't tax the network. Open also operates in colon mode, where you can specify a file or directory with the site name. For example ``open cse.unl.edu:/pub/foo'' can be typed and if ``foo'' is a file, ncftp will fetch it and write it in the the current local directory. If ``foo'' is a directory the current directory is set to ``foo.'' Note that if you invoke colon mode from the command line, ncftp exits after it fetches a file (but remains running if the pathname was a directory). This is nice if you are reading news and a poster gives a pathname in the message (often in colon mode format).

page
    You can read a remote file with your pager. In previous versions of ftp you could ``get myfile.txt |more'', but this wasn't widely known. This command also lets you view compressed files (ending in .Z), by piping the remote file through zcat first.

pls This lets you view a ls command with your pager.

pdir
    This command lets you view a dir command with your pager.

predir
    This lets you view the contents of the last ls or dir command with your pager. ncftp stores the output of the previous command in memory, so you can quickly relist the last command without going over the network. This is handy for slow connections.

redir
    This dumps the contents of the last ls or dir command to standard-out.

version
    This prints the version, and compile-time options used.

VARIABLES

set
    ncftp has some variables that can be set at run time in the .netrc or interactively in the shell. You can also use the command unset to undefine a variable. In csh, you type ``set var=value'' or ``unset var''. If a variable's value has whitespace in it, use double quotes, as in ``set var="the value"''. You can also type ``set'' by itself to show the values of all variables. In the .netrc you must use ``#set var=value'' and ``#unset var''. Hopefully if you need to use ftp it will think those commands are comments and ignore them.

    anon-password (string)
        is set to your email address, and used as the password when you login anonymously.

    ansi-escapes (integer)
        uses ANSI escape sequences for boldface, underline, and inverse text. So far this only affects the prompt. The default is 1 if your TERM is a vt100.

    auto-binary (integer)
        will set binary transfer mode each time you connect to a remote host.

    debug (integer)
        is used to print diagnostic information.

    local-dir (string)
        is set to the local current directory. This is mostly useful to set in the .netrc, where you may want to always download into a certain directory.

    logfile (string)
        is the log file that saves which sites you've opened and what files you've transferred. It should be set in the .netrc.

    logsize (integer)
        is the maximum size of the log before ncftp deletes old entries to keep the log around logsize.

    mprompt (1 or 0)
        specifies whether you want the mget, mput, etc., commands ask what to do with each file.

    pager (string)
        is the program used to page remote files. If you don't set it, it defaults to the value of the PAGER environment variable.

    prompt (string)
        is the command line prompt, which may use several @ and % flags (see below).

    progress-reports (integer)
        is the style of progress indicator to use. A value of 0 uses no indicator at all; a value of 1 shows the percentage of the the file being transferred; a value of 2 uses a nice bar graph progress indicator (this requires that the variable ansi-escapes also be set). Both styles 1 and 2 of progress indicators require that the remote server support the SIZE command. A value of 3 shows progress by printing the number of kilobytes transferred. This style is also used for remote servers who do not support the SIZE command.

    remote-is-unix (1 or 0)
        is true when the remote site seems to be a UNIX machine. The only reason one would want to unset this variable is when the program thinks a remote host is UNIX when it actually isn't.

    type (string)
        is the current file transfer type, like ``image''.

    verbose (integer)
        controls the level of output produced by the program. -1 is quiet mode, where it won't print anything, 0 is normal mode, where only errors are displayed, 1 is terse mode, where errors and messages from fancy ftp servers like wuarchive.wustl.edu are printed, and 2 is verbose mode, where plenty of output (mostly junk) is produced.

PROMPTS

The following flags insert special values into the prompt:

@B  Turns on boldface mode.

@D  Inserts the current remote directory.

@E or @!
    Inserts the event number (how many commands you've typed).

@H  Inserts the name of the remote host.

@I or @R
    Turns on inverse (reverse) video mode.

@M  Inserts ``(Mail) '' if you have mail.

@N  Inserts a newline character.

@P  Turns off any video modes you might have set with @B, @I, @R, or @U (if you have a vt100-ish terminal).

@U  Turns on underline mode (if you have a vt100-ish terminal).

The prompt may also contain % flags used by strftime(3) so you can insert the time or date to your liking. For example, put ``#set prompt="@! %I:%M %p @D ->"'' in your .netrc to show the event, the time of day, AM or PM, and the current remote directory in your prompt.

NETRC
Many users of ftp leave the power of the .netrc untapped. With ncftp, the file should begin with #set and #unset commands which ncftp runs at startup, followed by machine entries. When ncftp runs, looks for a file named .ncftprc or .netrc. Actually, the program tries ./ncftprc, ./.ncftprc, $HOME/.ncftprc, ./netrc, ./.netrc, and $HOME/.netrc in that order. If ftp complains about the #set and #unset commands (which should have been treated as comments), you should use a ncftprc if you plan on running both programs. Here is a sample .netrc file that shows what you can do with it:
#set logfile /user/students/ugrad/mgleason/.ftplog
#set prompt="@B@E @UNcFTP@P @B@M@D@P ->"
machine sumex-aim.stanford.edu
	macdef init
		cd /info-mac
		get ./help/recent-files.txt "|grep -v '.abs' > sumex
		!less sumex
		pwd
# This site is in here just so I can use ``apple''
# as an abbreviation.
machine ftp.apple.com
# ncftp will only ask for your password:
machine cse.unl.edu login mgleason
# You can supply a login and a password:
machine fake.machine.unl.edu
	login mgleason
	password mypass
	macdef init
	cd ./foo/bar
# If an antiquated non-UNIX machine doesn't use
# the "SYST" command, you may need to unset
# remote-is-unix, if the remote host complains
# about ``ls -CF.''
machine some.vms.unl.edu
	macdef init
	unset remote-is-unix

ENVIRONMENT
ncftp uses the following environment variables:

HOME
    for default location of a .netrc file, if ./netrc and ./.netrc do not exist;

PAGER
    for the default filter used by the page command;

SHELL
    for shell escapes;

MAIL
    for detecting new mail;

TERM and
TERMCAP
    for retrieving ansi-escapes.

AUTHORS
ncftp was written by Mike Gleason, NCEMRSoft (mgleason@cse.unl.edu), and based on code by the authors of the ftp from the BSD 4.3 distribution. ncftp is copyrighted 1992, 1993 by NCEMRSoft and 1985, 1989 by the Regents of California.

Some code and much debugging done by Phil Dietz, NCEMRSoft (pdietz@cse.unl.edu).

Extensive man page formatting work by DaviD W. Sanderson (dws@ssec.wisc.edu).

Jan-Piet Mens (jpm@Logix.DE) added termcap support and did the SCO port.

BUGS
Correct execution of many commands depends upon proper behavior by the remote server. The remote server may drop the connection if you take a long time when you page remote files. Termcap padding is not correctly displayed.

SEE ALSO
strftime(3), ftpd(8), ftp(1), nslookup(1), compress(1), zcat(1), tftp(1).