Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Linux ftp Command

Linux ftp Command

Linux Command Reference Linux Command Reference

On Linux systems,ftp the command is a command-line tool for interacting with FTP servers.

Pass ftp With the command, users can connect to a remote FTP server, upload or download files, and perform other file management operations.

What is FTP?

FTP (File Transfer Protocol) is a standard protocol for transferring files over a network. It allows users to upload and download files between different computers.

FTP is one of the earliest protocols used on the Internet and is still widely used today in areas such as file sharing and website maintenance.

In FTP, there are two main roles:

FTP uses two ports for communication:

Installation ftp Client Side

In most Linux distributions,ftp the client is usually pre-installed. If not, you can install it with the following command:

Debian/Ubuntu System:

sudo apt-get install ftp

CentOS/RHEL System:



sudo yum install ftp

Syntax

ftp [-dignv][主机名称或IP地址]

Parameters:


Example

1. Connect to the FTP server

For example, connect to ftp.example.com:



ftp ftp.example.com

After a successful connection, you will be prompted for a user name and password. If the FTP server allows anonymous access, you can use anonymous as the user name and your email address as the password.

2. Common FTP commands

Once connected to the FTP server, you can use the following common commands for file operations:

Example operations

Suppose you connect to ftp.example.com, and want to download a file named example.txt to the directory on the local computer ~/downloads , and follow these steps:

  1. Connect to the FTP server:


ftp ftp.example.com

Enter your user name and password.

  1. Switch to the target directory on the remote server (if needed):


cd /path/to/remote/directory

  1. Switch to the target directory on the local computer:


lcd ~/downloads

4. Download the file:



get example.txt

  1. Disconnect and exit:


bye


Security considerations

The FTP protocol itself is not encrypted, which means user names, passwords, and file contents may be intercepted during transmission. To improve security, the following alternatives are recommended:

Linux Command Reference Linux Command Reference