Connect and work on an FTP using the terminal

To upload, download or manage the content of an FTP we have endless graphic applications, Filezilla is one of the most popular. But how to do this from the command line?

Especially when we work on a server and we do not have a GUI, we need to upload a file to an FTP or simply delete something, create a folder, etc, do anything and we only have our terminal, nothing else.

To work with an FTP server, a single command is enough:

ftp

We put the ftp command and followed by it the IP address (or host) of the FTP server we want to connect to and that's it, for example:

ftp 192.168.128.2

As shown in the image below, the user will ask us, we write it and press Enter, then it will ask us for the password, we write it and press Enter, ready we go!

ftp-user-login

Now is where we write the commands in this new shell which is the ftp shell, for example to list we use the command ls

ls

Here is a screenshot:

ftp-ls

There are many more commands, for example:

  • mkdir : Create folders
  • chmod : Change permissions
  • of the : Delete files

They look like the Linux ones right? ... hehe, if they write help in the FTP shell they get commands that they can use:

ftp help

The question (and some wonder) I imagine is ... how to upload a file right?

To upload a file the command is send

The syntax is:

send archivo-local archivo-final

For example, suppose I have in my Home a file called video.mp4 and we want to upload it to a folder called videos, the command would be:

send video.mp4 videos/video.mp4

They must always specify the name of the final video, it does not matter if it is the same or if they do not want them to change, they must specify it the same, it is mandatory.

As simple as that, the log / output that it returns is similar to this:

local: video.mp4 remote: videos / videdo.mp4 200 PORT command successful. 150 Opening BINARY mode data connection for test. 226 Transfer complete. 0 bytes transferred. 0.00 KB / sec.

As I always tell you, if you want to know many more options, just read the command manual:

man ftp

Or read the manual at someplace from Internet.

Well that, I do not pretend that this is a super manual, much less ... it is to lay the foundations only

Still, I hope it has been useful to some.

regards


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   barnarasta said

    Good contribution!!!!
    If you want to make an automated connection with »ftp» and it is not necessary to put user & pass, you have to create the file in the user's $ HOME
    .netrc with chmod 600 permissions, containing:
    machine [name-defined-in- / etc / hosts] login [username] passwd [passwdor]
    ....

  2.   peterczech said

    Good article friend: D ..
    By the way, the previous topic of desdelinux for my project since I created a new theme of my own and in the end I chose Drupal as the CMS instead of WordPress.

    1.    eliotime3000 said

      I already knew you were going to opt for Drupal (for theme design, Drupal is like Blogger on steroids).

      With regard to updates, it is easier to use the drush than to manage everything at the end of FTP.

      1.    peterczech said

        Well Drupal is more than just Blogger on steroids: D ... It serves very complex content very well and is very scalable. The learning curve is much bigger than that of Joomla and abysmal compared to WordPress, but Drupal does not limit you in anything and its speed deserves an effort :).

  3.   eliotime3000 said

    Excellent. I was already saying why these commands appear when using FileZilla.

  4.   Saúl Uribe said

    I know that the intention of the post is to show how to connect with a single command, but I really recommend midnight commander (mc), it allows you to connect to an FTP / SFTP and send (upload) files in such a simple way.

    Well, there my contribution to the community. Cheers

  5.   neoki75 said

    Good afternoon,

    I'm doing a practice that requires me to connect to an FTP server from a kali linux VM and it tells me command not found when I put ftp or man ftp on it.

    I'm missing something, right?

  6.   Edd said

    I just installed, and well I connect to my local server, and when I try to send a file I get an error
    "553 Could not create file."
    this message I get. What could be failing?