How to Use ftp Command in Linux
- Open a Terminal: Launch a terminal window on your Linux system.
- Connect to an FTP Server: Type
ftp
followed by the hostname or IP address of the FTP server, and press Enter.
ftp ftp.example.com
- Login: Enter your username and password when prompted.
Name (ftp.example.com:yourusername): yourusername
Password: yourpassword
- Navigate and Manage Files:
- List Files: Use
ls
ordir
to list files and directories on the server. - Change Directory: Use
cd
to change the directory on the server. - Upload Files: Use
put
followed by the file name to upload a file to the server. - Download Files: Use
get
followed by the file name to download a file from the server.
- List Files: Use
Example Session
ftp ftp.example.com
Name (ftp.example.com:yourusername): yourusername
Password: yourpassword
ftp> ls
ftp> cd directory_name
ftp> put localfile.txt
ftp> get remotefile.txt
ftp> bye
How to setup and configure an FTP server in Linux?
FTP (file transfer protocol) is an internet protocol that is used for transferring files between client and server over the internet or a computer network. It is similar to other internet protocols like SMTP, which is used for emails, and HTTP, which is used for websites. FTP server enables the functionality of transferring files between server and client. A client connects to the server with credentials and depending upon the permissions it has, it can either read files or upload files to the server as well. In this article, we will see how to set up an FTP server, configure user permissions, configure a firewall, and finally encrypt our FTP traffic with SSL.