DevOps Essentials

View on GitHub



ftp – Internet file transfer program


ftp [-46AadefginpRtvV] [-N netrc] [-o output] [-P port] [-q quittime] [-s srcaddr] [-r retry] [-T dir,max[,inc]] [[user@]host [port]] [[user@]host:[path][/]] [file:///path][ftp://[user[:password]@]host[:port]/path[/][;type=X]] [http://[user[:password]@]host[:port]/path] […]

ftp -u URL file […]


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.

The last five arguments will fetch a file using the FTP or HTTP protocols, or by direct copying, into the current directory. This is ideal for scripts.



Logging in

$ ftp username@hostname
Trying 2.16.1336.33...
Connected to some_domain_name.
220 Akamai Content Storage FTP Server
331 Password required for hostname.
230 User username logged in.
Remote system type is UNIX.
Using binary mode to transfer files.

To see the dir contents and to move into a directory

ftp> ls
ftp> cd dirName

To download a file

ftp> get resume.pdf
local: resume.pdf remote: resume.pdf
229 Entering Extended Passive Mode (|||55093|)
150 Opening BINARY mode data connection for 'resume.pdf' (53077 bytes).
100% |*********************************************************************| 53077       12.58 KiB/s 00:00 ETA
226 Transfer complete.
53077 bytes received in 00:04 (12.57 KiB/s)

To change to a local directory and print its path

ftp> lcd /tmp
Local directory now: /tmp
ftp> lpwd

To print the current directory on remote ftp server

ftp> pwd
Remote directory: /pub/FreeBSD

To delete a file in current remote directory

ftp> delete fileName

To copy one file at a time from the local systems to the remote ftp server, enter:

ftp> put fileNameOnLocal