MAN page from RedHat Other ncftp-2.4.3-0.i386.rpm
NcFTP
Section: User Commands (1)
Updated: 2.4.3
Index NAME
NcFTP - Internet file transfer program
SYNOPSIS
ncftp[
program options][[
open options]
hostname[
:pathname]]
OPTIONS
Program options:
-D : Turn debug mode and trace mode on.
-L : Don't use visual mode (use line mode).
-V : Use visual mode.
-H : Dump the version information.
Command-line open options:
-a : Open anonymously.
-u : Open with username and password prompt.
-p X : Use port number X when opening.
-r : Redial until connected.
-d X : Redial, delaying X seconds between tries.
-g X : Give up after X redials without connection.
Command-line retrieve options:
-C : Force continuation (reget).
-f : Force overwrite.
-G : Don't use wildcard matching.
-R : Recursive. Useful for fetching whole directories.
-n X : Get selected files only if X days old or newer.
DESCRIPTION
NcFTPis a user interface to the Internet standard
File Transfer Protocol.This program allows a user to transfer files to and from a remote networksite, and offers additional features that are not found in the standardinterface,
ftp.
The program runs in one of three modes:visual mode, line mode, and colon mode.
If your system is somewhat modern, the default mode should bevisual mode.This is a full-screen interface that uses thecurseslibrary.With visual mode, you edit the program's settings with a nice screeninterface instead of typing arcane commands.
If you are not in visual mode, you will be usingline modefor the interactive shell.This mode is a no-frills command-line interface that will look like thedefaultftpprogram's command shell.
The third mode,colon mode,refers to the program's ability to do a quickretrieve of a file directly from your shell command line, without goinginto the program's own shell.This mode is useful for shell scripts.
INTRODUCTION TO VISUAL MODE
When entering visual mode, the screen clears and is rewritten with thesplash screen.You should see the black status bar occupying the second to last row onthe screen.Beneath the status bar is the input line, where you type commands to theprogram's shell.
The program then waits for you to do something.Usually this means you want to open a remote filesystem to transfer filesto and from your local machine's filesystem.To do that, you need to know the symbolic name of the remote system,or itsInternet Protocol (IP) address.For example, a symbolic name might be ``typhoon.unl.edu,'' and its IPaddress could be ``129.93.33.24.''To open a connection to that system, you use the program'sopencommand:
open typhoon.unl.eduopen 129.93.33.24
Both of these try to open the machine called typhoon at theUniversity of Nebraska.Using the symbolic name is the preferred way, because IP addresses maychange without notice, while the symbolic names usually stay the same.
When you open a remote filesystem, you need to have permission.TheFTP Protocol'sauthentication system is very similar to that oflogging in to your account.You have to give an account name, and its password for access to thataccount's files.However, most remote systems that have anything you might be interestedin don't require an account name for use.You can often get anonymous access to a remote filesystem and exchangefiles that have been made publicly accessible.The program attempts to get anonymous permission to a remote system bydefault.What actually happens is that the program tries to use ``anonymous'' asthe account name, and when prompted for a password, uses your E-mail addressas a courtesy to the remote system's maintainer.You can have the program try to use a specific account also.That will be explained later.
If the connection succeeded, you should see the status bar change to holdthe remote system's name on one side, and the current remote directoryon the other side.To see what's in the current remote directory, you can use the program'sls and dircommands. The former is terse, preferring more remote filesin less screen space, and the latter is more verbose, giving detailedinformation about each item in the directory.
You can use the program'scdcommand to move to other directories on theremote system.The cd command behaves very much like the command of the same name in theBourne and Korn shell.
The purpose of the program is to exchange data with other systems.You can use the program's getcommand to copy a file from the remote system to your local system:
get README.txt
The program will display the progress of the transfer on the screen, soyou can tell how much needs to be done before the transfer finishes.When the transfer does finish, then you can enter more commands to theprogram's command shell.
You can use the program'sputcommand to copy a file from your system to the remote system:
put something.tar
When you are finished using the remote system, you can open another oneor use thequitcommand to terminate the program.
THE BOOKMARKS FILE
One of the program's goals is to minimize typing and maximize convenience.The program automatically saves information about the sites you call onin a special file called thebookmarksfile, which is stored in the.ncftpsubdirectory of your home directory.Each bookmark saves the host name along with other settings, including theremote directory you were in, the account information, and more.This makes it easy to call back a site later and have everything be likeit was when you left the last time.
A big advantage of saving this information is that you can refer to a siteby a shorter, more meaningful name, instead of using the full symbolichost name for a site.For example, if you called a site named ``typhoon.unl.edu'' frequently, itsbookmark name might be just ``typhoon.'' Then, instead of:
open typhoon.unl.edu
you could use:
open typhoon
You could also abbreviate the bookmark name further, as long as the programwill know which site you are referring to.If no other bookmark's name starts with theletters ``ty,'' you could do just:
open ty
Use the bookmarking feature to assign mnemonic names to hosts whose realnames don't give much hint to what you call there for.A popular game calledNethackis archived at linc.cis.upenn.edu, inthe /pub/NH3.1 directory.You could assign ``nethack'' as the bookmark name for this site.Then you could try:
open nethack
instead of:
open linc.cis.upenn.edu
USING THE BOOKMARK EDITOR
To manipulate the bookmarks stored in your bookmarks file, you use theprogram's bookmark editor.Run the bookmark editor by typing thebookmarkscommand from within the program.This brings up a new screen of information.
On the right side is the list of remote systems the program has savedfor you already.Each time you open a connection to a remote system, the program saves anentry in your bookmark file for you automatically.If you have not opened any sites successfully yet, this list would beempty.
On the left side is some instructions saying what you can do with thelist.The bookmark editor is waiting for you to do something, like select a bookmarkwhose settings you want to edit.
Some bookmark editor ``hot key'' commands are one key only.You do not need to hit enter after the hot key commands.To exit the bookmark editor for example, you would just type the ``x'' keyonly.The multi-key commands require a slash first and do require the enter key.To delete the selected site, for example, you would type the ``/'' key,then ``del,'' and then the enter key.
You can use the ``d'' key to move down one line in the list, and the``u'' key to move up one line.If you have many entries in the bookmark list, you won't be able to see themall at once.The bookmark list scrolls as appropriate to bring the other sites into view.Use the ``p'' and ``n'' keys to move pages at a time.
Another way to select a site in the bookmark list is to use the capital letters.If I had many entries in my bookmark list, but wanted to select a site whosebookmark name was ``nethack,'' I could type ``N'' and the list would zoomto the first site with bookmark starting with the letter ``n.''
After you have hilited a bookmark you want to edit, use the/edcommand.Doing that brings up another screen with the settings for that bookmark.
In theBookmark Optionsscreen, you use hot keys to select a setting to edit.To edit the bookmark name, for example, you would type ``a.''When you are finished editing this bookmark, hit the ``x'' key to return tothe bookmark editor's screen.
BOOKMARK OPTIONS
Edit theBookmark namefield to change the name you use to open this site with.Remember, when you change the bookmark name , you must use this name torefer to this particular bookmark, so if you change it to ``foobar,''you need to use ``open foobar.''This is required because you can have multiple entries for a remote host.For example, you could have two bookmarks for wuarchive.wustl.edu, named``wumac'' and ``wuwindows.''If you were to say ``open wuarchive.wustl.edu,'' it would not be clear to theprogram which host entry to use.
Change the login information for the site by editing theUser, Password, and Accountfields.Normally you would want to leave these as is for anonymous logins.Depending on your situation, you might want to use a specific accounton the remote system.This is one way to get the program to use a non-anonymous login.
TheDirectoryfield specifies the directory to move to upon successfulconnection to the remote host for this bookmark.When you close the site, this field is updated for you automatically tobe the directory you were in when you closed the site.
TheTransfer Typefield can be changed to use a different translationmode when transferring files.This program is usually running on aUNIXsystem, and most remote systemsare alsoUNIXvariants, so the default transfer type isbinary,which does no translation at all.
However, when you need to work with plain text files and transfer thembetweennon-UNIXsystems, you can change this toASCII.That will guarantee that the text-only files will translate correctly.Most often, you will need to use thebinarytransfer type.
ThePortfield can be changed so that the program tries to use anon-standard port number.I have yet to ever need a different port number, but this capability ishere in case it's needed.
TheHas SIZE Commandfield will probably not need to be edited.This field is mostly for your information only.The SIZEcommand is anFTP Protocolcommand that the program wouldlike the remote server to support.If it is supported, the program can get an exact number of bytes ofremote files before transferring.That is nice to know so the progress reports work better.
TheHas MDTM Commandfield will probably not need to be edited either.If the remote server supports it, the program can get the exactmodification date of the remote file, and set the local file to thesame date.
TheCan Use Passive FTPfield specifies whether the remote serverallows use of theFTP Protocol's PASVcommand.There are two ways to set up FTP connections.The default way is what I callPort FTP.Unfortunately,Port FTPcannot be used when your local host is hidingbehind aFirewall.Passive FTPcan be used with a firewall, and that's why I would like touse that method if possible.You probably will not need to edit this field, since this can be detectedautomatically most of the time.
TheOperating Systemfield is used by the program to tell if it can relyon certain dependencies to specific operating systems.If the OS is a UNIX variant, the program can make some assumptions aboutthe remote server's responses.For example, if the OS isUNIX,thelscommand tries to use the-CFflags,like you could with ``/bin/ls -CF'' onUNIX.If the OS wasn'tUNIX,the ``-CF'' might not make sense to the remoteserver and it might complain.You probably will not need to edit this field, since this can be detectedautomatically most of the time.
The comment field can be used to store a brief description about the site.For example, for my ``nethack'' entry, I could use this field to hold``Archive site for latest version of Nethack.''When you are in the bookmark editor's window, if you hilite a site that hasa comment, it is printed at the bottom of the screen so you do not have toedit the site to look at it.
PREFERENCES
In addition to remote-host specific options, the program has global optionsthat are user-configurable. To change the program's preferences, run theprefscommand from within the program.
TheDefault open modefield specifies how the program should try to open connections.If you do a lot of anonymous FTPing, you should leave this set toanonymous.You might want to set this field touser & passwordif the hosts you FTP to most often don't allow anonymous logins.For example, if you are using the program on your company network tocopy things from different company machines, you would not want to useanonymousFTP mode.
TheAnonymous passwordfield lets you change the value given to the remote host when you use ananonymous login.It is customary (and sometimes required) to use your e-mail address as thepassword for anonymous FTP, so the remote host's administrator knows whois using the service.If the program didn't get your e-mail address right, or you want to usesomething different, you can change it here.
The program now uses more whitespace than before to reduce eyestrain.If you prefer, you can turn off that feature by changing theBlank lines between cmdsfield.
The program can log the transfers you do to a file so you can refer to thelog if you can't remember where you got something.To turn on the log, which is saved as~/.ncftp/log,you can set theUser log sizefield to a number greater than zero.You probably do not want to let this file grow forever, so you set themaximum size of the log by setting that field.
Although the program is perfectly happy saving every site you ever openin the bookmarks file, you may want to put an upper bound on the number ofsites saved.If you have a slow machine, which might cause the program to take awhileto load and save the bookmarks, or if disk space is at a premium, you canset theMax bookmarks to savefield to limit the number of bookmarks saved.Once that limit is reached, the program will discard sites whose time sincethe last connection is the longest.In other words, a site you only calledonce a long time ago and forgot about will be the first to go.
A few program functions need to use apagerprogram to view large amounts of text.For example, thepagecommand retrieves a remote file and uses the pager to view it.You can specify the program to use (and its command line flags, if any)by setting thepagerfield.
When you transfer files between the remote host and your local host, theprogram uses aprogress meterto show you the status of the transfer.The program has a few different progress meters to choose from, and youcan try out the other ones by changing theProgress meterfield.
You can control how much of the remote server's chatter is printed bychanging theRemote messagesfield.The program always prints error messages, but most of the time the remoteserver doesn't have anything useful to say.There are a couple of messages that may be worth printing.The first is thestartup message.Typically, when you connect to a server it has some important informationabout the server.Some servers havechdir messages,which are sent when you enter a special directory.You specify whether to print these messages by toggling theRemote messagesfield.
By default, the program stays in the same directory you were in when youran the program, so that downloads will go in that directory.I like to use a ``download directory'' so that all of my downloads go toa specific directory.This prevents me from exceeding my quota, and overwriting my other files.You can set theStartup in Local Dirfield to have the program change the local directory each time when theprogram starts up.Then you know where to expect your downloads to end up.
The program itself has some messages which you may get tired of and wantto turn off.You can change theStartup messagesfield to specify whether the program prints its ``splash screen'' andwhether it prints atipon how to maximize use of the program.
When you retrieve a remote file, by default the program tries to also setthe exact modification time of the local file as the remote file.You can turn that off by changing the File timestampsfield.
If you don't like the full-screen graphics, you can use the line-orientedmode by changing theScreen graphicsfield.Once you turnvisualmode off from thePreferencesscreen, you won't be able to get back to the preferences screen againwhen usinglinemode.To get back into visual mode, you can run the program with the ``-V''flag, like:
ncftp -V
COMMAND REFERENCE
I will now describe the commands that the program's command shell supports.The first command to know is
help.If you just type
help
from the command shell, the program prints the names of all of the supportedcommands.From there, you can get specific help for a command by typing the commandafter, for example:
help open
prints information about theopencommand.
The shell escape command is simply the exclamation point, !To spawn a shell, just do:
!
You can also use this to do one command only, like:
!date +%H:%M:%S
Thecdcommandchanges the working directory on the remote host.Use this command to move to different areas on the remote server.If you just opened a new site, you might be in the root directory.Perhaps there was a directory called ``/pub/news/comp.sources.d''that someone told you about.From the root directory, you could:
cd pubcd newscd comp.sources.d
or, more concisely,
cd /pub/news/comp.sources.d
Then, commands such asget, put, and lscould be used to refer to items in that directory.
Some shells in theUNIXenvironment have a feature I like, which is switching to the previousdirectory.Like those shells, you can do:
cd -
to change to the last directory you were in.
Theclosecommand disconnects you from the remote server.The program does this for you automatically when needed, so you can simplyopen other sites or quit the program without worrying about closing theconnection by hand.
Sometimes it may be necessary to use thecreatecommand.This makes an empty file on the remote host.This can be useful when you are unable to contact the remote server'sadministrator, but hope someone in the know will spot your file.For example,
create readline2.0.tar_is_corrupt
might persuade someone to repost that file.
Thedebugcommand is mostly for use by me and the testers.You could type
debug 1
to turn debugging mode on.Then you could see all messages between the program and the remoteserver, and things I print only in debugging mode.If you report a bug, I might ask you to send me atracefile.To do that, you would run the program, and then type
debug trace 1
And so I could see how the program was compiled, you would type
version
After you quit the program, you could then send me an email with thecontents of the~/.ncftp/tracefile, which would also have the version information in it.
Thedircommand prints a detailed directory listing.It tries to behave likeUNIX's``/bin/ls -l'' command.If the remote server seems to be aUNIXhost, you can also use the same flags you would withls, for instance
dir -rt
would try to act like
/bin/ls -lrt
would onUNIX.
Theechocommand wouldn't seem very useful, but it can be nice for use with theprogram's macros.It behaves like the equivalent command does under aUNIXshell, but accepts some extra flags.All ``percent'' flags are fed throughstrftime(4).So you could type
echo It is now %H:%M on %B %d.
and you should get something like this printed on your screen:
It is now 19:00 on January 22.
There are also ``at'' flags, which the program expands:
@H : Name of connected host@D : Full pathname of remote current working directory@J : Short name of remote current working directory@N : Newline.@n : Bookmark name of connected host
Example:
echo "Connected to @H at %H:%M." >> junk
If you later looked at the contents of ``junk,'' it might say:
Connected to sphygmomanometer.unl.edu at 20:37.
Thegetcommand copies files from the current working directory on theremote host to your machine's current working directory.To place a copy of ``README'' in your local directory, you could try:
get README
Thegetcommand has some powerful features which are described below, in``SPECIAL DOWNLOADING FEATURES.''
Thebookmarkscommand runs theBookmark Editor.You already know how what that does, since you read the section above on it,right?
Thelcdcommand is the first of a few ``l'' commands that work with the local host.This changes the current working directory on the local host.If you want to download files into a different local directory, you coulduselcdto change to that directory and then do your downloads.
Another local command that comes in handy is thellscommand, which runs ``/bin/ls'' on the local host and displays the resultsin the program's window.You can use the same flags withllsas you would in your command shell, so you can do things like:
lcd ~/doclls -lrt p*.txt
The program also has a built-in interface to the name service viathelookupcommand.This means you can lookup entries for remote hosts, like:
lookup cse.unl.edu ftp.cs.unl.edu sphygmomanometer.unl.edu
prints:
cse.unl.edu 129.93.33.1typhoon.unl.edu 129.93.33.24sphygmomanometer.unl.edu 129.93.33.126
There is also a more detailed option, enabled with ``-v,'' i.e.:
lookup -v cse.unl.edu ftp.cs.unl.edu
prints:
cse.unl.edu: Name: cse.unl.edu Address: 129.93.33.1ftp.cs.unl.edu: Name: typhoon.unl.edu Alias: ftp.cs.unl.edu Address: 129.93.33.24
You can also giveIPaddresses, so this would work too:
lookup 129.93.33.24
prints:
typhoon.unl.edu 129.93.33.24
Thelpagecommand views a local file one page at a time.By default, the program uses your pager program to view the files.You can choose to use the built-in pager by using the ``-b'' flag.Example:
lpage -b ~/.ncftp/bookmarks
Thelpwdcommand is prints the current local directory.Use this command when you forget where you are on your local machine.
Thelscommand prints a brief directory listing.It tries to behave likeUNIX's``/bin/ls -CF'' command.If the remote server seems to be aUNIXhost, you can also use the same flags you would withls, for instance
ls -rt
would try to act like
/bin/ls -CFrt
would onUNIX.
Themkdircommand tries to create a new directory on the remote host.For many public archives, you won't have the proper access permissions todo that.
Some servers let you use different transfer modes. Most servers supportonly the default mode, which isstreammode. The program supports that mode and alsoblockmode. The primary advantage to using this mode is that you can use thesame data connection for all your transfers. Withstreammode the program and server must establish a new data connection foreach file, and doing that takes extra time and bandwidth.To use the modecommand to turn on block mode, you would type
mode b
and the command to use stream mode would be
mode s
The program turns on block mode automatically when it knows the remoteserver supports it and implements it correctly, so you should not needto use this command.
Theopencommand connects you to a remote host.Many times, you will simply open a host without using any flags, butnonetheless theopencommand has some flags to enable certain features.
To force an anonymous open, use the ``-a'' flag.On theftp.ncftp.commachine, which is the official archive site forNcFTP,I have a need to use both anonymous logins and user logins.TheBookmark Editorremembers type of login I used last, so if the last timewas a user login, I could use the ``-a'' flag to switch back to theanonymous login type without having to use theBookmark Editorto change that.
Likewise, I could use the ``-u'' flag to force a user open.Then I could give my account name and password to access that account.
Many of the big archive sites likewuarchive.wustl.eduare busy, so you aren't guaranteed a connection to them.The program lets you ``redial'' sites periodically, until a connectionsucceeds.Use the ``-r' flag to turn on automatic redial.
Redial itself has a few parameters.You can set the delay, in seconds, of the time spent waiting betweenredials.You can also have the program give up after a maximum number of redialsis reached.Here's an example that fully utilizes redial mode:
open -r -d 75 -g 10 bowser.nintendo.co.jp
The ``-r'' turns on redialing, the ``-d'' sets the redial delay to 75seconds, and the ``-g'' flag limits redialing to 10 tries.If you like, you can just trust the default redial settings and only use``-r.''
Theopencommand will run theBookmark Editorif you don't supply a hostname to open.You can use theBookmark Editorto select a host and open it by hitting thereturnkey.
Thepagecommand lets you browse a remote file one page at a time.This is useful for reading README's on the remote host without downloadingthem first.This command uses whatever program you have set thepagerfield in thePreferencesscreen to view the file.
Thepdir and plscommands are equivalent todir and lsrespectively, only they feed their output to your pager.These commands are primarily forline modebecause directory listings can scroll offscreen.If you do a normallswhile invisualmode, if it would go offscreen, the built-in pager kicks in automatically.Therefore I don't recommend usingpdir and plswhile invisualmode.
Theredir and predircommands give you a way to re-display the last directory listing.The program saves the output from the lastdir or lscommand you did, so if you want to see it again you can do this withoutwasting network bandwidth.Thepredircommand is the same asredir,except that the output is fed to your pager.
I have found that I mostly download, and have next to no need at all toupload.But theputcommand is there in case you need to upload files to remote hosts.For example, if I wanted to send some files to a remote host, I could do:
lcd ~/docs/filesput 02.txt 03.txt 05.txt 07.txt 11.txt
Theputcommand won't work if you don't have the proper access permissions onthe remote host. Also, this command doesn't have any of the specialfeatures that thegetcommand has, except for the ``-z'' option.
Thepwdcommand prints the current remote working directory.Invisualmode, this is in the status bar.
If you need to change the name of a remote file, you can use therenamecommand, like:
rename SPHYGMTR.TAR sphygmomanometer-2.3.1.tar
Of course, when you finish using the program, typequitto end the program(You could also usebye, exit, or ^D).
Thequotecommand can be used to send a directFTP Protocolcommand to the remote server.Generally this isn't too useful to the average user (or me either).
Therhelpcommand sends a help request to the remote server.The list ofFTP Protocolcommands is often printed, and sometimes some other information that isactually useful, like how to reach the site administrator.
Depending on the remote server, you may be able to give a parameter tothe server also, like:
rhelp NLST
One server responded:
Syntax: NLST [ <sp> path-name ]
If you need to delete a remote file you can try thermcommand.Much of the time this won't work because you won't have the properaccess permissions.This command doesn't accept any flags, so you can't nuke a whole treeby using ``-rf'' flags like you can onUNIX.
Similarly, thermdircommand removes a directory.Depending on the remote server, you may be able to remove a non-emptydirectory, so be careful.
Thesetcommand is provided for backward compatibility with older versions of theprogram, and is superseded by theprefscommand.The basic syntax is:
set option value
Where the option is the short name of the corresponding field in thePreferencesscreen.The short names of the preferences fields can be found by browsing your~/.ncftp/prefsfile.This command is mainly for use withline mode,but since that mode is no longer officially supported by me, I want todiscourage the use of this command.
One obscure command you may have to use someday issite.TheFTP Protocolallows for ``site specific'' commands.These ``site'' commands vary of course, but one common sub-command thatis useful that some sites support ischmod, i.e.:
site chmod 644 README
Try doing one of these to see what the remote server supports, if any:
rhelp SITEsite help
You may need to change transfer types during the course of a session witha server.You can use thetypecommand to do this. Try one of these:
type asciitype binarytype image
If you ever need to contact me about the program, please familiarizeyourself with theversioncommand.This command dumps a lot of information that tells me which edition of theprogram you are using, and how it was installed on your system.Here's a way to save the output of this command to a file, so you cansend it to me:
version > version.txt
SPECIAL DOWNLOADING FEATURES
You probably already know that you use the
getcommand to copy files on the remote host to the local host.But the
getcommand has a few other tricks that you might find useful.First of all,
ncftpskips files you already have.If you try to
get file24
and there is a file named ``file24'' in the current local directoryalready, the program uses some additional heuristics to determine if itshould actually waste network bandwidth to download it again.
The program tries to get the date and size of the remote file ``file24.''If that file has the exact same date and size as the local file ``file24,''the program will skip over that file.If the program could not get the date or size of the remote file, orthe size differs, the program will go ahead and fetch the file.
In addition, if the local file's date is newer than the remote file'sdate, the program skips the download because it concludes you alreadyhave a more recent version.
What all this means for you is that you can use the program tomirroranother archive.For example, you might have a task that requires you keep a mirror ofall the files of a remote directory called ``files.''In that directory, there might be dozens of files, some of which are updatedoccasionally.You could usencftpto help you out by setting the appropriate local and remote directories,then simply doing:
get *
The program will skip over the old files, and only download the filesthat you don't have or have been updated since the last time.
Nonetheless, you may want to ignore the program's advice and download afile anyway, despite the program's thinking that you don't need to.You can use the ``-f'' flag withgetto force a download:
get -f README
You may also need to use the ``-C'' flag to force the program to continuedownloading where it left off.I sometimes call that feature ``forced reget'' for historical reasons.
You can also turn offwildcard matchingwithgetby using the ``-G'' flag.OtherFTPprograms used the syntax
get remote-file [local-file]
which allowed you to specify a local pathname for the file you were tryingto download.NcFTPdiffers in that respect, and if you used the older programs, you would findthat the program'sgetbehaves more like those other program'smgetcommand.This means that inNcFTP,that
get file01 file02
tries to download remote files named ``file01'' and ``file02.''If you like, you can get that older behavior by using the ``-z'' flag, so:
get -z file01 ../junk/files/01.txt
would get ``file01'' and use the local name ``../junk/files/01.txt.''
Another thing thatgetdoes is that you can use the ``-n'' flag to fetch files that are a certainnumber of days old or newer.If you just want to get the newest files at an archive, you don't have touse a full mirror.You can just say ``download all files that are 3 days old or newer.''Do that by going to a directory, and trying:
get -n 3 *
The program also has ``reget'' mode built into thegetcommand.Other FTP programs provided aregetcommand, which was useful when you lost a connection during a download.Instead of the remote host resending the entire file, you could use theregetcommand to continue the transfer where it was cut off.
NcFTPhas this capability built-in, and it examines the date and size of theremote file and local file to determine if the program should continuewhere it left off last time.If the dates are the same, but the local file is smaller, the programattempts to ``reget.''
The last, and most wasteful feature ofgetis recursive mode, which is turned on with the ``-R'' flag.This feature lets you download an entire directory's contents, i.e.:
get -R /pub/info/help
That creates a directory called ``./help'' in the current local directory,and copies all files and subdirectories into it.
Please use some discretion with this feature.If you get a large directory, you could really bog down the remote host.Archive administrators are providing a public service, so don't abuse thearchive so much that they have to shut down public access because thereal users of that archive can't get their work done.
MACROS
The program has a simple macro/alias facility.You can use macros to roll your own commands, or do things when certainevents happen.
To use macros, you will need to create and edit themacrosfile in your.ncftpsubdirectory of your home directory.Your~/.ncftpdirectory is created for you automatically the first time you run theprogram, but you have to make themacrosfile yourself since most users won't have a need for them.
You can have any number of macros.The syntax is:
macro macro-name macro-body...end
Here's a simple macro that users of the oldftpprogram might appreciate:
macro binary type iend
You could run that macro simply by running the program and typing the macroname as if it were a regularncftpcommand.
Macros can also have parameters, much like theKorn Shell'sshell functions and theC-Shell'saliases.These parameters are sent to your macro, and if your macro uses theappropriate ``dollar'' variables, they are expanded.To illustrate, try this macro:
macro cdls cd $1 lsend
To run that macro, open a connection and try:
cdls /pub
That would try tocdto /pub, and then try tolist its contents withls.
Dollar variables are somewhat like those in theBourne and Kornshells.Example syntax:
$4 : Argument 4$* : All arguments.$@ : All arguments, each of them surrounded by double quotes.$(2-5) : Arguments 2, 3, 4, and 5.$(2,5) : Arguments 2 and 5.$(3+) : Arguments 3, 4, 5, ..., N.
A better way to code the ``cdls'' macro might be:
macro cdls cd $1 ls $(2+)end
There are some special macros, which I callevent macros.The program looks for macros by special names, and if they exist,runs the macro when that event happens.
One event macro is the.start.ncftpmacro.If you have a macro by that name defined in your macros file, the programwill run that macro each time you run the program.
Similarly, there is also a.quit.ncftpmacro that is run each time you quit the program.
Another set of event macros are site-specific.For example, if I have a site bookmarked as ``typhoon'' I could then definemacros named.open.typhoonand.close.typhoonwhich would run each time I opened and closed ``typhoon.''
Another, more generic set of event macros are the.open.anyand.close.anymacros which run when I open or close any site.One possible use for these macros is to run separate shell scripts todo some processing after you finish using a site.I could have a macro like this:
macro .quit.ncftp echo "Started post-processing downloads at %H:%M:%S" !sh ~/scripts/download-decoder echo "Finished post-processing downloads at %H:%M:%S"end
Another use is to duplicate the oldmacdef inithack that the traditionalftpprogram used in its.netrcfile. For example:
macro .open.infomac echo "Getting recent files list" get -z /pub/info-mac/help/recent-files ~/docs/recent ls -lrtend
USING COLON MODE
The
colon-modefeature is used from your shell'scommand line.
In ancient times, way back during the Disco Era, you could use a programcalledtftpto fetch a file using the Internet standardTrivial File Transfer Protocol.You could use that program to do something like thisfrom within its shell:
get wuarchive.wustl.edu:/graphics/gif/README
and that would call wuarchive and fetch the README file.
You can use this program to do the same thing from your shell's commandline:
csh> ncftp wuarchive.wustl.edu:/graphics/gif/READMEcsh> head README
This tells your shell, in this case theC-shellto runNcFTP,whichwould open wuarchive, fetch /graphics/gif/README and write the file /READMEin the current working directory, and then exits.
The colon-modefeature is nice if you don'twant to browse around the remote site, and you know exactly want you want.It also comes in handy in shell scripts, where you don't want toenter the command shell, and might not want the program to spew output.
You can use theUniform Resource Locatorstandard also. For example, this would work:
csh> ncftp ftp://wuarchive.wustl.edu/graphics/gif/README
There are times where you might not want the program to write acolon-modefile in the current working directory, or perhaps you want to pipe theoutput of a remote file into something else.Colon-modehas options todo this.It was inspired by the guy who wrote theftpcatperl script.The ``-c'' option tells the program to write on the standardoutput stream.The ``-m'' option pipes the file into your pager (likemore)Of course this won't work if the thing you givecolon-modeis a directory! This example just dumps a remote file to stdout:
csh> ncftp -c wuarc:/graphics/gif/README
This example redirects a remote file into a differentlocation:
csh> ncftp -c wu:/README > ~pdietz/thesis.tex
This one shows how to use a pipeline:
csh> ncftp -c wuarc:/README | tail | wc -l10csh>
This shows how to page a remote file:
csh> ncftp -m wuarc:/graphics/gif/README
USING LINE MODE
The only reason I provideline modeis so that the primitive operating systems whosecurseslibrary is missing or dysfunctional won't render the program completelyuseless.
exceptions of the functions that requirevisual mode,such as thePreferences screen and the Bookmark Editor.You will have to edit the~/.ncftp/prefs and ~/.ncftp/bookmarksfile manually, with a text editor.
As a small consolation, you get to use the full-powered line-editinglibraries, likeGNU Readlineif they were compiled with the program.
SUMMARY OF COMMAND LINE OPTIONS
When you invoke the program from your shell, there are ``dash flags'' youcan use like you can with most otherUNIXprograms.
Here's a list of options you can use from the command line:
-D : Turns on debugging mode and tracing.-V : Uses ``visual'' mode for this session.-L : Uses ``line mode'' for this session.-H : Prints the information from the ``version'' command and exits.
When you turn on tracing, the program writes a log with debugging informationto a file calledtracein your.ncftpsubdirectory of your home directory.If you need to report a bug, it would be helpful to mail me thetracefile so I can track it down better.
In addition to the program flags, you can also use flags from theopen and getcommands with acolon modepath.Here's a really complex example:
csh> ncftp -r -d 120 -n 3 sphygmomanometer.unl.edu:/pub/stuff/*
This tries redialing that host every two minutes, and fetching all filesfrom the ``/pub/stuff'' directory that are 3 days old or newer.
AUTHOR
NcFTPwas written by Mike Gleason,(mgleasonAATTNcFTP.com).
NcFTPis copyrighted 1995 by Mike Gleason.All rights reserved.
As of this writing, the most recent version is archived in<ftp://ftp.ncftp.com/ncftp/>.
THANKS
Ideas and some code contributed by my partner, Phil Dietz,
Thanks to everyone who has helped test the program, and sent in feedbackover the years.Your support is what drives me to improve the program!
I'd like to thank my former system administrators, most notably Charles Daniel,for making testing on a variety of platforms possible, letting me havesome extra disk space, and for maintaining the UNL FTP site.
I also thank Dale Botkin and Tim Russell atProbe Technology,for givingncftpa home onprobe.net.
For testing above and beyond the call of duty, I am especially grateful to:Phil Dietz,Kok Hon Yin (hkokAATTyoda.unl.edu),Andrey A. Chernov (acheAATTastral.msk.su).
Thanks to Tim MacKenzie (t.mackenzieAATTtrl.oz.au) for the filenamecompletion code.
Thanks to DaviD W. Sanderson (dwsAATTssec.wisc.edu), for helping me out withthe man page.
BUGS
Due to a limitation in thecurseslibrary, scrolling may be slow in visual mode.
Shell escapes, suspending (^Z) and resuming, and interruping (^C) stillhave quirks withvisual mode.
There are no such sites namedbowser.nintendo.co.jporsphygmomanometer.unl.edu.
SEE ALSO
ftp(1),
ftpd(8),
nslookup(1),
archie(1),
rcp(1),
tftp(1).
Index
- NAME
- SYNOPSIS
- OPTIONS
- DESCRIPTION
- INTRODUCTION TO VISUAL MODE
- THE BOOKMARKS FILE
- USING THE BOOKMARK EDITOR
- BOOKMARK OPTIONS
- PREFERENCES
- COMMAND REFERENCE
- SPECIAL DOWNLOADING FEATURES
- MACROS
- USING COLON MODE
- USING LINE MODE
- SUMMARY OF COMMAND LINE OPTIONS
- AUTHOR
- THANKS
- BUGS
- SEE ALSO
This document was created byman2html,using the manual pages.