HMC Homepage      CS Home

NCFTP 2.0.4

A Configurable Interface to the File Transfer Protocol

NCFTP is a an interface to FTP (file transfer protocol). It offers many useful features not found in FTP.
Click on colored / underlined items to use this menu and move around the document.

More information about NCFTP can be found in the manual page ncftp(1). View it by typing:

% man ncftp



Getting Started

This is a brief introduction to NCFTP. If you are already familiar with basic FTP, you can skip this section. The rest of this document deals with features of NCFTP not found in FTP.

  1. Starting a Session

    At the shell prompt, type ncftp. You will then see the NCFTP prompt at the very bottom of your window.

    % ncftp
    ncftp>


  2. Help!

    NCFTP comes with built in help. To see a list of NCFTP commands, type:

    ncftp> help

    If you want to learn more about a certain command, type help followed by the command name. For example:

    ncftp> help ls

    ls: prints a remote directory listing.
    Usage: ls [items to list]



  3. Connecting

    The open command opens a connection to a remote ftp site. To connect to the machine ftp.unicamp.br, type:

    ncftp> open ftp.unicamp.br

    Trying to connect to ftp.unicamp.br...
    Guest login ok, access restrictions apply.


  4. Changing Directories

    Once you connect to a machine, your current remote directory will be shown on the right side of the status bar, the second line up from the bottom of your window. To see the contents of the directory you're currently in, type ls.

    ncftp> ls

    The cd command is used to change directories, just like the UNIX cd command.

    ncftp> cd games

    This will change your current directory to the games directory.


  5. Transferring Files

    The get command is used to tranfer files from the host machine to your machine. To get the file doom.tar.gz, type:

    ncftp> get doom.tar.gz

    You can include a path with the filename. For example if doom.tar.gz is in the pub/games directory but you are in pub, type:

    ncftp> get games/doom.tar.gz


  6. Exiting

    To end your NCFTP session, just type quit.

    ncftp> quit
    %

Menu



Auto Anonymous Login

NCFTP defaults to anonymous login, thus letting you easily connect to sites where you don't have an account. The program sends "anonymous" as your username, and your email address as your password. To connect to a site, say ftp.funet.fi, just type:

% ncftp ftp.funet.fi (from the command line)
or
ncftp> open ftp.funet.fi (from the NCFTP prompt)

You can disable auto anonymous login mode easily. There are several methods of doing this:
  1. Login to a site with username and password from the command line.
    Disable anonymous mode with -u.

    % ncftp -u osiris

    You can use the -u flag from the NCFTP prompt too.

    ncftp> open -u osiris

  2. It is possible to disable anonymous login and make user & password login your default using the prefs command. You'll see a list of options and be able to change default open mode from "anonymous" to "user & password".
Menu



Hosts Menu

When you connect to a site for the first time, a new entry is made in your hosts file. Now it is very easy to call that site again:
  1. Display the hosts menu.

    ncftp> hosts

  2. With the arrow keys, select from the menu the site you would like to call and press enter.

The hosts file is also used for setting preferences for each site, such as preferred username, password, login directory, and such. This is how you change preferences:
  1. Display the hosts menu.

    ncftp> hosts

  2. Select from the menu the site you would like to call with the arrow keys.

  3. Enter editing mode.

    /ed

  4. Select the site option you would like to edit by pressing its corresponding letter.

  5. When you're done, press x to exit editing mode.

  6. Press x to exit the hosts menu.
Menu



Redialing

If the site you called is busy (max number of users logged on), you can redial.

ncftp>open -r -d 60 -g 15 misspiggy.utoledo.edu

NCFTP will keep trying to open a connection ( -r ) to misspiggy, delay ( -d ) 60 seconds between tries, and give up ( -g ) after 15 attemps.

Menu



Paging

No more text scrolling off screen! Paging is useful for two things.
  1. Directory Listings

    The built in pager is always used when you type ls or dir.

  2. Text Files

    When you want to look at README or other text files, use the page command.

    ncftp> page README

The pager used for viewing text files can be set to either "more" or "less" in the prefs menu.

NOTE: The status bar is not redrawn after using "more" or "less". Press Control-L to redraw. Hopefully, this bug will be fixed in the next version.

Menu



get and put

Get

The NCFTP get command is very powerful. Here are the ways in which it is used to fetch files from the remote host.
  1. Get One File:

    This is how to fetch a file named README.

    ncftp> get README

  2. Get One File and Rename It:

    The file README will be renamed Read.Me.Now.

    ncftp> get -z README Read.Me.Now

  3. Get All Files That Match a Pattern:

    This is like UNIX wildcard matching. The * stands for any character(s). The following example shows how to get all files in the current directory ending with the extention .txt.

    ncftp> get *.txt

  4. Get Multiple Files:

    Just list all the files you want to get.

    ncftp> get foo1 foo2 foo3 foo4

  5. Get a Directory:

    In this example, NCFTP will get all the files in the directory /pub/games/dos and create a dos subdirectory in the download directory to put them in.

    ncftp> get -R /pub/games/dos

  6. Get Only New Files:

    This example shows how to get all files in the current directory that are 3 days old or newer.

    ncftp> get -n 3 *

Put

The put command is used to send files to the remote host. You need write permission to the remote host before you can send files.
  1. Send One File

    This sends the file foo to the remote host.

    ncftp> put foo

  2. Send One File and Rename It

    The file foo is sent and renamed foobar.

    ncftp> put -z foo foobar

Menu



Colon Mode

Colon mode allows the user to download a file in one step. Output redirection can be used with colon mode. Here are several examples.

  1. Basic Colon Mode:

    Give NCFTP the site, path, and filename all on one line. It will fetch the file and put it in your download directory.

    % ncftp ftp.funet.fi:/pub/picture/snoopy.jpg

    This example gets the file snoopy.jpg from the directory /pub/picture on the host ftp.funet.fi.


  2. File Piped Through Pager:

    The -m flag pipes a file through the more pager.

    % ncftp -m ftp.funet.fi:/pub/games/README


  3. File Sent To Standard Output:

    The -c flag sends a file to standard output where it can be redirected with the > symbol or piped with the | symbol.

    This sends a file to Joe Schmoe's docs directory instead of his regular download directory.

    % ncftp -c ftp.funet.fi:/pub/README > ~jshmoe/docs/README

    This sends a file through the wourd count (wc) program.

    % ncftp -c ftp.funet.fi:/pub/README | wc

Menu



Log File

NCFTP keeps track of files you download and stores the information in a log file. The full path and file name are:

~USERNAME/.ncftp/log

You can set the size of the log file in the prefs menu.

Menu



Prefs Menu

The preferences menu allows you to customize your NCFTP environment. I've put asterisks ( * ) by the options most users would want to change. To edit an option, press its corresponding letter. The menu is displayed when you type:

ncftp> prefs
                      Preferences

  A Default open mode:          anonymous
* B Anonymous password:         Joe_Schmoe@hmc.edu
  C Blank lines between cmds:   yes
  D Default FTP mode:           Send-Port FTP only (PORT)
* E User log size:              10240
  F Max hosts to save:          unlimited
* G Pager:                      more
* H Progress meter:             percent meter
  I Remote messages:            allow startup messages
* J Startup in Local Dir:       /home/jschmoe/download
  K Startup messages:           headers only
  L Network timeout:            30
  M Trace logging:              no
  N File timestamps:            try to preserve file timestamps
  O Screen graphics:            visual (curses)

  X (Done editing)

Menu



Macros

An NCFTP macro is a list of NCFTP commands that are all executed when you type the name of the macro. If you want to use macros, create a file named macros in your .ncftp directory. Each entry in the macros file should look like this:

macro MACRO_NAME
	COMMAND 1  
	COMMAND 2
	...
end


Here is an example of a useful macro that displays the date and time.


macro dt
        echo Date: %B %d
        echo Time: %H:%M
end

To use it, you would type:


ncftp> dt

Date: May 17
Time: 10:09
 
For more help with writing NCFTP macros, see the NCFTP man page.

% man ncftp

Menu
HMC Computer Science Department
Contact Information
Last Modified Tuesday, 22-May-2001 14:17:44 PDT