FTP From The Linux Terminal

Why would you want to use FTP from the Linux terminal? It’s quick, easy, consistent, and works well enough as an FTP client. If it’s not already installed, it’s just a quick installation command away. In my experience, it’s usually already there.

If I’m going to be transferring a bunch of files or editing files, I’ll just use a GUI FTP client. My choice FTP client has been Filezilla for quite a long time now. It does the trick and I just keep moving my profile/config to new computers as I get them. Being easy to migrate is a definite selling point for me.

So, what is FTP? It stands for File Transfer Protocol. It’s not encrypted, so many folks have moved to SFTP – which is actually not related to FTP at all. It just shares similar functionality. Even though FTP traffic isn’t secure, it’s still fairly widely used. 

An FTP server is probably not installed by default on your desktop Linux system. However, I’ve written how to Install An FTP Server With VSFTPD which should get you sorted if you need one.

The application will be using is “FTP” which describes itself like:

ftp — Internet file transfer program

And you may find that your version of terminal-based FTP is maintained by your distro maintainers. The FTP command and flagsr should still be pretty universal throughout. Still, be sure to check the man page – especially if things seem weird.

FTP From The Linux Terminal:

Obviously, this requires an open terminal.

Press CTRL + ALT + T and your terminal should pop right open.

Once you have the terminal open the command is basically this:

You can connect via domain name, hostname, or even IP address. It’ll look like this, or pretty close:

ftp from the terminal
See: You can use FTP from the Linux terminal.

There are many commands available, so you should probably check man ftp to see what’s on offer. We’re just going to cover a few of the more useful commands.

You’ll find that ‘ls’ works to list files, just like you’re used to, as does ‘cd’. If you want to change your local directory, that is your working directory on your machine and not the working directory on the server, you need to use the ‘lcd’ command – like so:

Note: Read More About Paths

After you’ve logged in and learned to navigate, it’s time to do something. If you want to download something, you use the ‘get’ command:

That will download the file from the server to the local directory. To do the opposite, that is upload something from your current local directory, you would use the ‘put’ command, like so:

If you want to get or put more than one file, the commands are ‘mget’ and ‘mput’ respectively. They look like this:

Note: It may give a warning about using passive mode. If that’s the case, add the -p flag to your connection command – like ftp -p hostname.

Just like with your regular terminal file management, you can ‘mkdir’, ‘rmdir’, and even use ‘pwd’ to be reminded of your present working directory. Files can also be deleted with the delete <file_name> command.

Closure:

And there you have it, an article that explains how to use FTP from the Linux terminal. It is important to note that the FTP command transmits data without encryption. If security is a concern, use SCP or SFTP.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Install An FTP Server With VSFTPD

FTP stands for File Transfer Protocol and is still a useful, if less secure, and quick way to transfer files from one computer to another. If you’ve enabled SSH, then SFTP (SSH File Transfer Protocol) is likely available and it’s truly a better option than FTP. If SFTP is an option, you should probably use it.

There are still people who prefer FTP and situations where FTP makes sense. I actually use it to transfer files around my home network with some regularity. Not only does it let me transfer files, I can also use the FTP application to do things like rename files, copy and move files, and even change file permissions. It’s more about the application at that point, I suppose. Of course, most FTP clients handle SFTP just fine these days.

FTP isn’t all that secure and, again, SFTP is likely a better option in every way, but VSFTPD is “VS” – meaning “Very Secure.” I mean, that’s what they claim – and they do have some security configuration options. So, it has that going for it.

Either way, this article is gonna tell you how to install it. What you do with that information is entirely up to you! If you do eventually want to use this information, there are a couple of previous articles that might suit your needs.

You might need to know about hostnames. Click here.
You may wish to know your IP address. Click here.

With that information read and at hand, let’s jump into installing VSFTPD!

Enable FTP with VSFTPD:

The reason I picked VSFTPD for this is because it’s pretty much universally available. It’s there for all the major distros, readily available in your default repositories. We’re not going to get deep into any configuration options, nor are we even going to discuss securing it. We’re simply going to install it and let you loose on the world!

To that end, why don’t we crack open our terminal? To do that, you can just use your keyboard – press CTRL + ALT + T and your default terminal should open. 

With that step done, let’s go ahead and install it:

Debian/Ubuntu:

Fedora/RHEL:

SEL/OpenSUSE:

Arch/Manjaro:

One of those should do the trick for the major distros. As much as I’d like to just leave it there, that’s not quite enough. I’ll also let you know that your configuration is largely done in  /etc/vsftpd.conf and you can use man vsftpd.conf to learn about configuring your new FTP server.

For the configuration basics, you’ll want to enable writing to the server (so that you can change files, including uploading them) and you’ll likely want to enable local access. Like other configuration files, you may need to remove the # from the start of the lines in order for them to be read and take effect. To comment out lines, you just add a # to the start of the line and the line will be ignored.

You can use nano, vim, or any plain text editor you want to edit the files. However, changes won’t take effect until after you restart the FTP server’s daemon. To do that, you use this command:

With this done, you can connect to your FTP server by using the hostname or the IP address, internal or external. There are links at the first section of the article that tell you how to find that information, though the site’s search works just fine. See? I actually DID have a reason for posting those!

Again, SFTP is a much better option. I actually plan on doing an article about SFTP, but that article requires linking to this sort of article and so I might as well write it first!

Closure:

And there you have it… Yet another article in the books. If you’d like to do a guest article, you can just write it and I’ll do the rest! Every other day as a publishing schedule isn’t too bad, but a break would be fun. Either way, enjoy your new FTP server and good luck!

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.