FTP command not found

FTP CFTHave you ever heard about FTP? It is a very popular protocol used to transfer files between servers or between a user’s computer and a server. While some people consider it to be insecure and instead prefer other options like SFTP, it is nonetheless used by thousands of users around the world, and today we are going to tell you how to resolve one of the most common errors we can receive while using this protocol, which is the FTP command not found error.

Actually, the “FTP command not found” error doesn’t come from the FTP protocol per se, but from the “ftp” binary, which is a software used to transfer files and folders between servers.

Yes, this tool has the same name as the FTP protocol, so it can be a bit confusing at first, so you have to keep in mind that in this case we are talking about the Linux binary called ftp, not about the FTP protocol (which is used by the binary).

How FTP command works on Linux

So first off let’s talk a bit about this ftp client. The ftp command is very simple to use, the following is the basic syntax:

ftp hostname

In this case, the syntax is pretty easy to understand: we will connect to the server identified by the “hostname” using the FTP protocol through the ftp command. Instead of a hostname, you can also use an IP address. If you can reach the remote server then it will ask for the FTP user and its password, so type them and then you will have completed the login process.

ftp command not found error

Once you are connected there are a lot of options that you can use, if you are not sure about what you are doing yo can type ‘?’ and hit enter to access the ftp help page. Some of the basic ftp commands that you can run while being connected to an FTP server are the following:

  • mkdir: to create new directories/folders.
  • ls: to list the files in the current directory.
  • cd: to change the directory in the FTP server.
  • lcd: to change the directory on your local machine.
  • delete: to remove a file. Be very careful while using this option.
  • rmdir: same as delete but for deleting directories.
  • pwd: use it to check which directory you are browsing.
  • get: with this command you can copy a file (or multiple files if you use mget) from the remote machine to your local computer.
  • put: use it to copy one file from your machine to the remote machine. If you want to copy more than one file then use mput.

There are a lot more options that you can use but these ones are the most used.

What is the cause of “FTP command not found” error on Linux/Unix?

So, as we said before one of the most common errors that you can get while trying to use the ftp command is the typical ftp command not found error. Why does this happen? What is the cause of this error?

The most common reason to get this error is pretty simple: the ftp software is not installed on the system. This sounds like a dumb error but it can happen, because a lot of Linux/Unix distros don’t come with the ftp tool installed by default, you need to install it on your own.

Another very common reason behind this error is for the binary not to be correctly installed, even if you are 100% sure that you have installed it. Well, it’s important to make clear that the ftp tool is installed in a very specific way, and you can’t confuse it with other related tools like vsftpd. If you install an FTP server like vsftpd then you are not installing the ftp binary, keep that in mind.

How to fix the error FTP command not found

So, how can we fix this error? We have already seen the two most common reasons behind the FTP command not found error, so now it is time to solve them.

For the first case is solution is to simply install the desired binary, remember that for this you need to use the root user or a user with sudo permissions, so open up your Terminal tool first, then if you’re running a CentOS/Fedora/RHEL system run the following:

yum install ftp

And if you are running Debian/Ubuntu run this:

apt-get install ftp

And that’s it. In a few seconds after a manual confirmation, you will have your new ftp binary installed and ready to use.

The other case we saw was if an FTP server was installed on your system instead of the ftp binary. To use the ftp binary you don’t install an FTP server like vsftpd, you have to install the ftp tool. To check if the ftp binary is installed you can do a search in your RPMs if your run CentOS/RHEL/Fedora:

rpm -qa | grep ftp

A result similar to the one below will indicate that you have the ftp tool installed.

[root@server1 ~]$ rpm -qa | grep ftp
ftp-0.17-77.fc28.x86_64

If you use Debian or Ubuntu then run this:

dpkg -l ftp

It will return the status of the ftp package, so it will tell you if it is installed or not.

In the case that the ftp binary is not installed, check the installations method described a little above in this article to fix the problem.

Summary

This time we have learned a bit about the FTP protocol and a lot about the ftp binary.

About the error: the ftp binary doesn’t come installed in some distros by default, which can lead us to the ftp command not found error when we try to use it. This problem is actually very easy to fix because the only thing that we have to do is to install the binary, which can be done in less than a minute as explained in this article.

We have noticed that very often people install an FTP server (for example vsftpd) instead of installing the ftp command, and then they get the ftp command not found error because they installed an FTP server, not the actual ftp binary. So always make sure that you are installing the right tool, not one related to it or one that has a similar name.

References:

About the Author: Esteban Borges

Experienced Sr. Linux SysAdmin and Web Technologist, passionate about building tools, automating processes, fixing server issues, troubleshooting, securing and optimizing high traffic websites.

Leave a Reply

Your email address will not be published.