The File Transfer Protocol (FTP) is a standard network protocol used for the transfer of computer files from a server to a client using the Client–server model on a computer network.
FTP is built on a client-server model architecture and uses separate control and data connections between the client and the server. FTP users may authenticate themselves with a clear-text sign-in protocol, normally in the form of a username and password, but can connect anonymously if the server is configured to allow it. For secure transmission that protects the username and password, and encrypts the content, FTP is often secured with SSL/TLS (FTPS). SSH File Transfer Protocol (SFTP) is sometimes also used instead; it is technologically different.
The first FTP client applications were command-line programs developed before operating systems had graphical user interfaces, and are still shipped with most Windows, Unix, and Linux operating systems.
ftp utility is used to connect,manage directories,upload/download files from an ftp server.
To connect to the FTP server, we have to type in the terminal window 'ftp' and then the domain name 'domain.com' or IP address of the FTP server.
Replace the IP and domain in the above examples with the IP address or domain of your FTP server.
If you connect to a so-called anonymous FTP server, then try to use "anonymous" as user name and a nempty password:
The commands to list, move and create folders on an FTP server are almost the same as we would use locally on our computer, ls for list, cd to change directories, mkdir to create directories...
Before downloading a file, we should set the local ftp file download directory by using 'lcd' command:
If you dont specify the download directory, the file will be downloaded to the current directory where you were at the time you started the FTP session.
Now, we can use the command 'get' command to download a file, the usage is:get file
The file will be downloaded to the directory previously set with the 'lcd' command.
To download several files we can use wildcards. In this example I will download all files with the .xls file extension.mget *.xls
We can upload files that are in the local directory where we made the FTP connection.
To upload a file, we can use 'put' command.
When the file that you want to upload is not in the local directory, you can use the absolute path starting with "/" as well:
To upload several files we can use the mput command similar to the mget example from above:
Once we have done the FTP work, we should close the connection for security reasons. There are three commands that we can use to close the connection:
Any of them will disconnect our PC from the FTP server.