ftp - Unix, Linux Command


ftp - Internet file transfer program


ftp [-pinegvd] [host]

pftp [-inegvd] [host]


ftp is the user interface to the Internet standard File Transfer Protocol. The program allows a user to transfer files to and from a remote network site.


-A' Use active mode for data transfers. This is useful fortransmissions to servers which do not support passive connections(for whatever reason.).
-p' Use passive mode for data transfers. Allows use of ftp in environments where a firewall prevents connections from the outside world back to the client machine. Requires that the ftp server support the PASV command. This is the default now for all clients (ftp and pftp) due to security concerns using the PORT transfer mode. The flag is kept for compatibility only and has no effect anymore.
-i' Turns off interactive prompting during multiple file transfers.
n' Restrains ftp from attempting ''auto-login'' upon initial connection. If auto-login is enabled, ftp will check the . netrc (see netrc(5)) file in the user's home directory for an entry describing an account on the remote machine. If no entry exists, ftp will prompt for the remote machine login name (default is the user identity on the local machine), and, if necessary, prompt for a password and an account with which to login.
-e' Disables command editing and history support, if it was compiled into the ftp executable. Otherwise, does nothing
-g' Disables file name globbing
-m' The default requires that ftp explicitly binds to the same interface for the data channel as the control channel in passive mode. Useful on multi-homed clients. This option disables this behavior.

Files cannot be extracted from a thin ftpchive.
-v' Verbose option forces ftp to show all responses from the remote server, as well as report on data transfer statistics
-d' Enables debugging.



To see help of all available commands in ftp

$ ftp

ftp> help


$ ftp
ftp> help
Commands may be abbreviated.  Commands are:

!               dir                 mdelete        qc               site
$              disconnect      mdir              sendport     size
account     exit                mget            put             status
append     form               mkdir           pwd            struct
ascii         get                 mls              quit             system
bell          glob                mode           quote          sunique
binary       hash               modtime      recv             tenex
bye           help               mput           reget            tick
case          idle                newer          rstatus          trace
cd             image            nmap           rhelp            type
cdup          ipany             nlist             rename        user
chmod       ipv4               ntrans          reset            umask
close         ipv6               open            restart          verbose
cr              lcd                 prompt         rmdir            ?
delete       ls                   passive        runique
debug       macdef           proxy           send


To Changing FTP Mode to binary or ascii

ftp> ascii


200 Type set to A.


To Download a file using ftp:

ftp> get README  

200 PORT command successful.  
150 ASCII data connection for README (,3134) (2881 bytes).  
226 ASCII Transfer complete.  
local: README remote: README  
2939 bytes received in 0.066 seconds (43 Kbytes/s)


To Uploading a file to FTP server:
ftp> put README
200 PORT command successful.
150 Opening ASCII mode data connection for README.
226 Transfer complete.
local: README remote: README
1882 bytes sent in 0.0095 seconds (1.9e+02 Kbytes/s)


To Changing the remote and local directory:

ftp> pwd

257 "/myftpserver" is current directory.

ftp> cd dir1

250 CWD command successful. "/myftpserver/dir1" is current directory.

ftp> pwd

257 "/myftpserver/dir1" is current directory.


Listing the contents of remote directory from FTP

ftp> ls


200 PORT command successful.
150 ASCII data connection for /bin/ls (,3133) (0 bytes).

. . .
226 ASCII Transfer complete.
418 bytes received in 0.043 seconds (9.5 Kbytes/s)


To Uploading multiple files with mput command:

ftp> mput Makefile


200 PORT command successful.
150 Opening ASCII mode data connection for Makefile.
226 Transfer complete.
local: Makefile remote: Makefile
1020 bytes sent in 0.0062 seconds (1.6e+02 Kbytes/s)


To Close a FTP connection:

ftp> close


221 Goodbye.