File Transfer Protocol (FTP) is old and is used in many public websites to share files. The service usually runs on port 21. FTP requires that an FTP server be installed and running on the remote machine. We can use the traditional ftp command or the newer lftp command to access an FTP-enabled server. The following commands are supported by both ftp and lftp. FTP is used in many public websites to share files.
To connect to an FTP server and transfer files to and from it, use the following command:
$ lftpusername@ftphost
It will prompt for a password and then display a logged in prompt:
lftp username@ftphost:~>
You can type commands in this prompt, as shown here:
- cd directory: This will change directory on the remote system
- lcd: This will change the directory on the local machine
- mkdir: This will create a directory on the remote machine
- ls: This will list files in the current directory on the remote machine
- get FILENAME: This will download a file to the current directory on the local machine:
lftp username@ftphost:~> get filename
- put filename: This will upload a file from the current directory on the remote machine:
lftp username@ftphost:~> put filename
- The quit command will terminate an lftp session
Autocompletion is supported in the lftp prompt