Tuesday, November 6, 2012

Command Line FTP

http://shell4.tdl.com/techsupport/ftp.html


Why use Command-Line FTP?
Command line FTP allows you to transfer files between the tdl server and a remote server via the Internet backbone at T1/T3 speeds. This means that the transfer will take place very quickly, and will not use your modem connection at all. One example of use would be transferring images from a remote clip art ftp area to your account for use on your home page.
FTP Commands
Logging in, Logging Out
CommandFunction
ftpOpens an ftp session from your shell account to a remote server. You must first log into your shell account.
Example:ftp servername
You will be prompted for your user name and password.
byeCloses your ftp session with the remote server.
You will return to your regular shell prompt after closing your ftp session.

Modes
When transferring files, it is very important to make sure you are in the correct mode.
Command
Function
asciiThis is the default mode, and this is to be used when transferring text files.
Example:ascii
binThis mode must be used when transfering graphics (jpg, gif files.
Examplebin

Listings and Directory Changing
CommandFunction
lsLists the current directory contents
Example:ls
cdPerforms the same function as clicking an icon in MAC/Windows or cd in DOS -- it changes directories. Alternating cdls, you can find your way down the directory tree of the remote host to the files you are looking for.
Example:cd subdirectory
cd ..Backs you up one directory level (to the parent directory). Otherwise, the syntax is cd [directoryname]. It is helpful to visualize the tree structure of a directory while you are exploring a remote server using ls and cd.
Example:cd ..
lcdChanges your local working directory -- where you are on the machine you are ftp'ing from. This is where files will be putfrom, and where get will deposit them.
Examplelcd subdirectory
lcd ..Backs you up one directory level (to the parent directory) of your local working directory much like cd .. backs you up one directory level on the remote machine.
Example:lcd ..
mkdirMakes a directory on the remote server.
Example:mkdir [newdirectoryname]

Transferring Files
You can transfer one file at a time (by naming the file) or many with the use of the * character.
CommandFunction
putPuts one file to the remote location
Example:put filename.ext
mputPuts multiple files to the remote location
Example:mput * to put all files in your local current directory to the remote directory)
or mput *.html to put all .html files
or *.jpg to put all jpg images
or *.gif to put all gif images
getGets a single file.
Example:get filename.ext
mgetGets multiple files. You can use the * as you did with the mputcommand.
Example:mget *
or mget *.html to get all .html files
or *.jpg to get all jpg images
or *.gif to get all gif images
delDeletes a file or directory.
Example:del filename - deletes a specific file
del * - deletes all files and directories*
del *.html - deletes all html files
del *.jpg - deletes all jpg files
del *.gif - deletes all gif files
del directoryname - to delete a specific directory*
*Note: A directory cannot be deleted unless it is empty.
promptWhen you begin a file transfer, by default, you are prompted to confirm the transfer of each and every file. You can turn this off by typing prompt which toggles this feature off. (Typingprompt again turns it back on). This is especially useful when transferring multiple files and want them to go all at once without asking you to confirm each and every one.
Example:prompt
hashThe hash command is the equivalent of a status bar in the Windows O/S. hash lets you know the progress of your file transfer if you turn it on. For example, if you are transferring a 200 meg file and you do not have hash toggled on, you have no indication as to whether or not it is transferring.Since hash slows the ftp process, a general rule of thumb is that if you are transferring large files, turn hash on so you can make sure the files are transferring. If you have many small files to transfer, turn it off.
Example:hash

Return to support index.
Return to shell4 home.

No comments:

Post a Comment