FTP (File Transfer Protocol) is a standard network protocol used to transfer files to and from a remote network.

In this tutorial, we will show you how to use the Linux ftp command through practical examples.

In most cases, you will use a desktop FTP client to connect to the remote server and download or upload files. However, the ftp command is useful when you work on a server without GUI and you want to transfer files over FTP to or from a remote server.

Before You Begin

FTP traffic is not encrypted. For a secure data transfer, use SCP or SFTP .

To be able to transfer files, you must have at least read permissions on the source file and write permission on the target system.

When transferring large files it is recommended to run the ftp command inside a screen or tmux session.

The directory from where you run the ftp command is the local working directory.

Establishing an FTP Connection

  1. To open an ftp connection to a remote system, invoke the ftp command followed by the remote server IP address or domain name. For example, to connect to an FTP server at “192.168.42.77” you would type:
ftp 192.168.42.77
  1. If the connection is established, a confirmation message will be displayed, and you will be prompted to enter your FTP username, in this example the FTP username is linuxize:
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 21:35\. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
Name (192.168.42.77:localuser): linuxize
You may see a different confirmation message depending on the FTP service running on the remote server.
  1. Once you enter the username you will be prompted to type your password:
Password:
  1. If the password is correct, the remote server will display a confirmation message and the ftp> prompt.
230 OK. Current restricted directory is /
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

If the FTP server you are accessing accepts anonymous FTP accounts, and you want to log in as an anonymous user, use anonymous as username and your email address as a password.

#linux

How to Use Linux FTP Command to Transfer Files
1.30 GEEK