ftp remote-machineThe remote machine will prompt for a username and password for the remote machine.
user login-nameafter which you will be prompted for your password again. (You could of course just quit and try the whole ftp again if this is simpler.)
You will be in your home directory. Use
dirand
cdto look for the file(s) you would like to transfer or the directory you would like to transfer file(s) to.
Next select a file transfer type. If the file is just a plain text ascii file, use:
asciior if the file is a binary file (or you are just not sure), use:
binaryUsing ascii will make sure that new-lines are converted to the right type of new-line for the system in question. Remember compressed files are usually binary and postscript, uuencoded and binhex programs are ascii. Then you can get a file by typing
get filenameor if you would like to call the file something else locally,
get filename local-filenameor put a file by typing
put filenameor
put filename remote-filenameIf you would like to get a number of files use
mget fileswhere files can contain a wildcard.
prompt
To close the connection type:
closeyou can then open another connection using
open remote-machineor just quit with
quit
Unix
Here is an example.
Say we want to transfer a file letter.tex from mssls7 to mssly3
First go into the directory on the machine you would like the file to be
(mssly3):
cd lettersand type
ftp mssls7The remote machine (in this case mssls7) will prompt you for your login name and password for that machine.
Connected to mssls7.mssl.ucl.ac.uk. 220 mssls7.mssl.ucl.ac.uk FTP server (SunOS 4.1) ready. Name (mssls7:your_name): your_name 331 Password required for your_name. Password:your_passwordIf you logged in correctly you will get the following message and prompt:
230 User your_name logged in. ftp>Now change directory to get to where letter.tex resides:
cd ~/docs/texBecause the letter is a TeX file (and is therefore human-readable), you should choose type ascii:
asciiand then get the file:
get letter.texFinally you can close the connection and quit:
close quitor just say quit or bye:
bye
If you wanted all your tex files in ~/docs/tex you should do as above but instead of the `get' command first type:
promptand the:
mget *.tex
foreach FILE ( * ) mv $FILE `echo $FILE | cut -f 1 -d ';' | tr A-Z a-z` endor just log onto VMS, ftp to Unix and `put' them from VMS to Unix (rather than logging onto Unix, ftping VMS and `get'ting then from VMS to Unix).
VMS disks and directory names aren't much of a problem just use cd (e.g.,
cd disk$xray:[user.files] cd morefiles
Here is an example.
You want to transfer all your TeX documents on mssla3 to mssly3.
You know that on the VAX the filenames have version numbers and you don't want
to convert them when they get to mssly3 so you decide to `put' the files from
mssla3 to mssly3 (rather than get them from mssla3 to mssly3).
set def disk$u1:[your_name.letters] ftp mssly3 220 mssly3.mssl.ucl.ac.uk FTP server (OSF/1 Version 5.60) ready. Connected to mssly3.mssl.ucl.ac.uk. Name (MSSLY3:your_name): your_name 331 Password required for your_name. Password: your_password 230 User your_name logged in. FTP> cd ~/docs/tex 250 CWD command successful. FTP> mput *.* FTP> close 221 Goodbye. FTP> quit
lcdTo execute something in a shell while in ftp use an exclamation mark, for example to check your local directory use:
!lsTyping `help' at the ftp prompt will give a list of commands available in ftp on the remote machine (this will be different for different machines).
Other commands which might prove useful (if available) are:
man ftp
Use
anonymousas the Name
your_name@mssl.ucl.ac.ukas the password.
Anonymous ftp can also be accessed with WWW browsers like Netscape using URLs of the form
ftp://site.address.whatever.country/directory/subdiretcory/file
This file stores the machine name, login, password and lists of ftp commands to execute at that site.
Do NOT store any passwords other than anonymous ones in this file An example file is:
machine src.doc.ic.ac.uk login anonymous password user@mssl.ucl.ac.uk machine ftp.funet.fi login anonymous password user@mssl.ucl.ac.uk macdef init cd /pub/OS/Linux/PEOPLE/Linus/v1.2 bin prompt get linux-1.2.13.tar.gz close quit machine unix.hensa.ac.uk login anonymous password user@mssl.ucl.ac.ukThis example contains three entries the first and thirs of which just save the user from typing in the anonymous login name and email address as password.
The second shows the macdef command which defines a macro for frequently used
command sequences. In this case the macro is a special one called `init' and
so will run automatically after typing `ftp ftp.funet.fi'.
This can be used in conjunction with the `at' command to ftp something
automatically at night when network traffic is lower.
To do this create a file (for this example called `go_ftp') containing just
ftp sitenameand make it executable
chmod 755 go_ftpThen set off the go_ftp command at a suitable time:
at 0400 ./go_ftpand the next time it gets to 0400, the go_ftp file will run the ftp command it contains and ftp will look in your .netrc file, see the `macdef init' and run the commands therein automatically.
Entries in the .netrc file must be separated by a blank line as in the example and or your .netrc file will be permanently removed.
For more information
man netrc
mcopy file a:To copy files from a PC diskette to the current directory, use
mcopy a:file .where the dot `.' just means the current directory and could be replaced with a different directory. To delete files on a floppy use
mdel a:fileTo do a dir use:
mdir a:The full list of DOS-like commands is
man mtoolsNote that when using wildcards (`*' and `?') you must use single quotes around the wildcard filename, e.g.,
mcopy a:'*.*' ~/dosprogs/Warning DOS ascii files use CARRIAGE-RETURN (0D) LINEFEED (0A) to mark the end of a line while UNIX uses just a LINEFEED (0A).
mcopy -t a:letter.doc .
A URL is a Universal Resource Locator - a unique address to specify the type of file, the machine it is on (anywhere in the world), the path to the file (the directories) and the filename itself.
The URL of this document might be is:
http://www.mssl.ucl.ac.uk/www_computing/buns/ftp.html
For example, if you want the program make-3.74.tar.gz in the /gnu directory at src.doc.ic.ac.uk you would use the URL
ftp://src.doc.ic.ac.uk/gnu/make-3.74.tar.gz