Working with FTP from the command-line might sound trivial, as there are a lot of excellent FTP clients on Linux that provide a GUI to work with. Still, many users of the File Transfer Protocol use it over SSH and servers so that a GUI app won’t work.
There are a few useful command-line FTP clients on Linux. In fact, in the past, I talked about one great command-line app in my list of the best FTP clients for Linux. That said, in this post, we will not be focusing on that app, as it’s much too complicated for what we need it for; basic upload and download. Instead, we will use the standard GNU FTP client.
Note: the GNU FTP client will not work with SFTP or FTPS. It can only connect to FTP servers.
Install FTP CLI
The GNU FTP app is widely used, so, this package may already be pre-installed on quite a few distributions. That said, not every single distribution has the client pre-installed, so it’s a good idea to go over how to get it working before going over how to use it.
To install the FTP app on your Linux operating system, open up a terminal window by pressing the Ctrl + Alt + T or Ctrl + Shift + T keyboard combination. From there, follow the detailed instructions that correspond with the OS you are currently using.
On Ubuntu Linux, the CLI FTP client is available in the “Ubuntu Main” software repository. To install it on your system, you must use the Apt terminal command.
sudo apt install ftp
The CLI FTP client has supported Debian Linux for a very long time. As a result, it’s easily installable via the “Debian Main” software repository.
To install the CLI FTP app on your Debian PC, use the Apt-get command below.
sudo apt-get install ftp
Arch Linux users won’t be able to search the package repositories for an “FTP” package if they want to use this app, as the developers do not package the CLI FTP app separately. Instead, to use FTP from the command-line on Arch Linux, you must install the “inetutils” package with Pacman.
sudo pacman -S inetutils
The command-line FTP client is available to Fedora Linux users through the “Fedora x86_64” and “Fedora i386” software repositories. If you’re a Fedora user, install the package with the following Dnf command in a terminal window.
sudo dnf install ftp
OpenSUSE users looking to use the CLI FTP client on their operating system will be happy to know that the program is installable on Leap 15.0, Leap 42.3 and Tumbleweed via the “OpenSUSE Oss All” software repository.
To start the installation on your SUSE system, launch a terminal window and use the Zypper command below.
sudo zypper install ftp
The standard command-line FTP client used on Linux that we will be covering in this article is part of the GNU Project. For this reason, it’s very easy to track down this app for all Linux operating systems out there.
To install the CLI FTP client on your Linux operating system, open up a terminal. Then, search for and install “ftp” or “inetutils”. Alternatively, if you can’t find the app anywhere in software sources, check out how to grab the source code from GNU.org.
Connect to FTP server over CLI
To start a new connection with your server in the FTP CLI application, go to the terminal and use the ftp command along with the IP address of the remote server.
Note: can’t figure out the remote IP address of your FTP server. Check out our guide about how to find out an IP address on Linux.
Assuming the address is successful, the FTP app will prompt the user to enter a username and password. Write in your server’s username and password, and you’ll gain access over CLI to the FTP server.
Download FTP files over CLI
Downloading files over FTP in the command-line is done with the get command. To start a download, try out the following command syntax.
Let the FTP client download the file(s) to your system. When successful, they’ll appear in the directory the terminal on your Linux PC started in (usually /home/username/).
Upload FTP files over CLI
Uploading files with the FTP command-line application uses the send command. To send a file or folder to a remote server, follow the command syntax below.
Sending files over FTP will take a few minutes. When the process is done, you’ll see it in the default upload directory on the remote server.