Perform basic file transfer operations against an FTP server: connect, authenticate, list remote files, download artifacts, upload a report, and exit cleanly. Use this workflow to move backup data in legacy environments while documenting what was transferred.
You need to upload and download files from an FTP server to
support a legacy backup workflow. You will connect to an FTP
server, authenticate using anonymous login, list available
files, download readme.txt, upload a local
report.log, and then close the session properly.
FTP is legacy and typically unencrypted. In production, prefer SFTP/SSH or HTTPS-based transfers when possible. When FTP is unavoidable, focus on precise commands, clear validation of transfers, and leaving an audit trail.
ftp <host>.
ls to list remote directory contents.
get and
put.
bye or
quit.
ftp ftp.lpic-server.org
This starts an interactive FTP client session and prompts for a username.
Connected to ftp.lpic-server.org.
220 (vsFTPd 3.0.3)
Name (ftp.lpic-server.org:lab):
anonymous
Anonymous FTP commonly accepts any password (often an email address) depending on server policy. The key outcome is a successful login and transfer mode selection.
331 Please specify the password.
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ls
Validate what is available before transferring. This also helps confirm you are in the expected remote directory.
-rw-r--r-- 1 ftp ftp 1048576 Jan 01 12:00 backup.tar.gz
-rw-r--r-- 1 ftp ftp 20480 Jan 01 12:01 readme.txt
readme.txt to the local machine.
get readme.txt
This pulls the remote file into the current local working directory. Confirm the transfer completes successfully.
local: readme.txt remote: readme.txt
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection.
226 Transfer complete.
report.log.
put report.log
This pushes the local file to the remote server using the same filename unless otherwise specified.
local: report.log remote: report.log
200 PORT command successful.
150 Opening BINARY mode data connection.
226 Transfer complete.
bye
Properly exiting ensures the control connection is closed and prevents hanging sessions on the server.
221 Goodbye.
ftp <host>
: Starts an interactive FTP client session to the specified server.
anonymous
: Common username for anonymous FTP access when enabled by the server.
ls
: Lists remote directory contents within the FTP session.
get <remote_file>
: Downloads a file from the FTP server to the local machine.
put <local_file>
: Uploads a local file to the FTP server.
bye / quit
: Terminates the FTP session and closes the connection.