How CentOS uploads and downloads files using FTP commands at the command line

Source: Internet
Author: User
Tags ftp commands ftp connection ftp login

In this article, we describe how to use the FTP command in a Linux shell. This includes how to connect to an FTP server, upload or download files, and create folders. Although there are many good FTP desktop applications Now, there are many applications for command line FTP commands in server, SSH, and remote sessions. Like what. Requires the server to pull the backup from the FTP repository.

650) this.width=650; "src=" http://www.linuxidc.com/upload/2015_12/151216195960471.jpg "width=" 524 "height=" 434 "/ >

Step 1: Establish an FTP connection

To connect to an FTP server, enter and then space on the command to ftp follow the FTP server's domain name ' domain.com ' or IP address

For example:
    1. ftp domain.com

    2. ftp 192.168.0.1

    3. ftp [email protected].com

Note: The anonymous server is used in this example.

Replace the following example with an IP or domain name for your server address.

650) this.width=650; "src=" Http://www.linuxidc.com/upload/2015_12/151216195960473.png "alt=" FTP Login "width=" 706 " Vspace= "5"/>

FTP Login

Step 2: Login with username and password

The vast majority of FTP servers are password protected, so these FTP servers ask for 'username' and 'password'.

If you connect to an FTP server known as an anonymous FTP server (LCTT: That is, you do not need to have real user information to use as an anonymous FTP server), you can try to use the username as anonymous well as the blank password:

    1. Name: anonymous

    2. Password:

After that, the terminal will return the following information:

    1. 230Login successful.

    2. Remote system type is UNIX.

    3. Using binary mode to transfer files.

    4. ftp>

Login successful.

650) this.width=650; "src=" Http://www.linuxidc.com/upload/2015_12/151216195960472.png "alt=" FTP Login Successful "width=" 706 " Vspace= "5"/>

FTP Login Successful

Step 3: Directory Operations

FTP commands can list, move, and create folders as if we were using our computer locally. You can ls print a list of directories, cd you can change the directory, mkdir you can create folders.

Listing directories using security settings
    1. ftp>ls

The server will return:

    1. 200 PORT command successful.Considerusing PASV.

    2. 150Here comes the directory listing.

    3. directory list

    4. ....

    5. ....

    6. 226Directory send OK.

650) this.width=650; "src=" Http://www.linuxidc.com/upload/2015_12/151216195960474.png "alt=" Print Catalog "width=" 706 " Vspace= "5"/>

Print Catalog

Change Directory:

Change the directory to enter:

    1. ftp>cd directory

The server will return:

    1. 250Directory succesfully changed.

650) this.width=650; "src=" Http://www.linuxidc.com/upload/2015_12/151216195960475.png "alt=" ftp Change Directory "width=" 706 " Vspace= "5"/>

Changing Directories in FTP

Step 4: Download files using FTP

Before downloading a file, we first need to use the lcd command to set the local accept directory location.

    1. lcd /home/user/yourdirectoryname

If you do not specify a download directory, the file will be downloaded to your working directory when you log in to FTP.

Now, we can use command get to download the file, for example:

    1. getfile

The file is saved in the directory location that is set using the LCD command.

Server return message:

  1. local:file remote:file

  2. 200 PORT command successful.Considerusing PASV.

  3. 150Opening BINARY mode data connection forfile(xxx bytes).

  4. 226File send OK.

  5. XXX bytes received in x.xx secs (x.xxx MB/s).

650) this.width=650; "src=" http://www.linuxidc.com/upload/2015_12/151216195960476.png "alt=" Download file using FTP "width=" 706 " Vspace= "5"/>

Download files using FTP

You can use wildcard characters and commands to download multiple files mget . For example, I'm going to download all the files ending with. xls in the following example.

    1. mget *.xls

Step 5: Upload files using FTP

FTP can also upload files after FTP connection is completed

To put upload a file using a command:

    1. put file

The absolute path can be used when the file is no longer in the current local directory:

    1. put /path/file

Again, you can upload multiple files:

    1. mput *.xls

Step 6: Close the FTP connection

After completing the FTP work, you need to close the connection for security reasons. There are three commands to close a connection:

    1. bye

    2. exit

    3. quit

Any command can disconnect the FTP server and return:

    1. 221Goodbye

650) this.width=650; "src=" Http://www.linuxidc.com/upload/2015_12/151216195960477.png "width=" 706 "vspace=" 5 "/>

For more help, you can use the FTP command to get more help after you connect to the server help .

650) this.width=650; "src=" Http://www.linuxidc.com/upload/2015_12/151216195960478.png "width=" 706 "vspace=" 5 "/>


This article is from "Little public who" blog, please make sure to keep this source http://xiaogongju.blog.51cto.com/12830710/1981507

How CentOS uploads and downloads files using FTP commands at the command line

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.