-
On local, issue the ftp command with the name of foreign
% ftp foreign Connect to ``foreign.''
% ftp 128.193.96.10 Connect using IP number.
-
The file $HOME/.netrc describes accounts on remote machines.
-
When the connection is established, foreign comes back to
ask for your user ID on foreign. Give your user ID for the
foreign machine or just try [Enter] if you have the same user ID on
both machines. If that is okay, you will be asked for your password on
foreign.
-
Your life is simpler if you have the same user ID and password on all
machines.
-
If you must sign on to the other machine (if it complains to
you that you are not logged in, for example), issue the user command. An
example is:
ftp> user rubin Tell foreign your user ID.
-
After telling you that you are logged onto foreign, you'll see
an ftp prompt, ftp>, and you are ready to begin.
-
If you want to see your options, just ask with:
ftp> "?" List ftp subcommands.
Some useful subcommands within ftp:
ftp SUBCOMMANDS
- ls
- List files in foreign's working directory.
- pwd
- Print name of foreign's working directory.
- cd dirname
- Change directory in foreign.
- ! command
- Execute command on local.
- bye (quit)
- End ftp session.
- get file
- Copy file from foreign to local.
- get file -
- Get file from foreign and send it to the screen.
- get file |more
- Get file from foreign and view it using more.
- mget file1 file2 ...
- Multiple get, i.e., copy several files.
- mget *
- Multiple get all files.
- put file
- Copy file from local to foreign.
- mput file1 file2 ...
- Copy multiple files from local to foreign.
Note that while you cannot make all the file manipulations on foreign that you can when remotely logged in, you can make enough to do
some real damage (the purpose of ftp is file transfer, not
damage).
-
It is safer to begin by orienting yourself with the "list" or
"print working directory" command.
-
To send a file from local to foreign, use the send
or put command:
ftp> send file.local file.foreign
ftp> put file.local file.foreign
(On some systems the file.foreign designator can be left out, in
which case the file named file.local will appear automatically
on the foreign machine.)
-
Be patient while files are being transferred; when the transfer is
complete, you will be told that it was successful and also the transfer
rate achieved. If either machine or network has a heavy load,
this may take some seconds.
-
Note that if you are ftping to a CMS machine, you must specify
the file name and file type. However, since the ftp
separator for file name and file type is a period ".," it can look very
much like Unix file designators, for example,
ftp> send Unix file cmsname.cmstype
-
If your Unix file is unix.file and you do not give any CMS
file name
ftp> send unix.file
your CMS file will appear as Unix file a.
-
To get a file from foreign and place it
on local, you get it
ftp> get file.foreign file.local
-
When you are done transferring files, you quit ftp with
ftp> quit End ftp session.
-
As noted before, if you want to transfer many files, it is probably
easier to concatenate them into one large file, transfer that large
file, and then split it up into subroutine files with fsplit
or csplit. Likewise, you can use the tar command
to create a file with as many directories and subdirectories in it as
you like, transfer this one tar file, and then extract all the directories
and subdirectories from the tar file. This assumes you have write
privilege on the foreign machine.
-
A number of files can be sent or ``gotten'' with the multiple versions of
these commands. For example:
ftp> mget file1 file2 file3 Get these three files.
ftp> mput file1 file2 file3 Send these three files.
Don't take a walk after giving these multiple commands. You will be
queried before each transfer as to whether you really want to go ahead
with it, unless you use the prompt command for no interactive
prompting:
ftp> prompt Toggle prompt on or off.
Interactive mode off. No interactive prompting.
ftp> mget *.f Get all files ending in .f.