How to upload files using FTP commands over SSH in Linux

Source: Internet
Author: User
Tags ftp commands

Next I will use the Linux SSH command to upload files to another FTP space as an example to introduce some instance methods for uploading files using the FTP command in ssh.

If there is no ftp prompt:-bash: ftp: command not found
Install the ftp application: yum install ftp
# Ftp 127.0.0.1 21 enter the ftp ip address and port number of the remote space, and press ENTER
Enter the user name and password as prompted!
Ftp> Local LCD working directory
Ftp> cd remote directory
Ftp> binary data is transmitted in binary format.
Ftp> tick: Enable the byte counter during transmission. Run the command again to disable it.
Ftp> mput File

FTP> bye (or by) ends the ftp command parameter session with the remote computer in linux and exits the ftp command parameter in linux.

FTP> cd to change the working directory on the remote computer.

FTP> get use the current document conversion type to copy remote documents to the local computer.
Format: get remote-file [local-file]

FTP> LCD changes the working directory on the local computer. By default, the working directory is the directory for starting ftp command parameters in linux.

Format: LCD [directory]

FTP> ls displays the abbreviated list of remote directory documents and subdirectories.

FTP> mdelete delete Delete the documents on the remote computer.
Format: mdelete remote-files [...]
Description: remote-files indicates the remote document to be deleted.

FTP> mdir: displays the remote directory documentation and subdirectory list. You can use mdir to specify multiple documents.
Format: mdir remote-files [...] local-file
Description: remote-files specifies the directory to view the list. You must specify remote-files. Type-use the current working directory on the remote computer.

1. Connect to the ftp server

Format: ftp [hostname | ip-address]
A) in the linux Command Line, enter: ftp www.boluo.org
B) The server will ask you for your username and password, and enter the username and password respectively. After the authentication is passed, you can.

2. Download an object

The get and mget commands are usually used to download files:

A) get format: get [remote-file] [local-file]
Transfers files from the remote host to the local host.
To obtain/ftp/1.raron the server
Ftp> get/ftp/1.rar 1.rar (Press ENTER)

B) mget format: mget [remote-files]
Receives a batch of files from the remote host to the local host.
To obtain all files on the server or ftp
Ftp> cd/ftp
Ftp> mget *. * (Press ENTER)

Note: All files are downloaded to the current directory of the linux host.

3. upload files

A) put format: put local-file [remote-file]
Transfers a local file to the remote host.
If you want to transfer the local 1.zip file to the remote host/ftp, and change it to 1.rar
Ftp> put 1.zip/ftp1.rar (Press ENTER)

B) mput format: mput local-files
Transfers a batch of files from the local host to the remote host.
To upload all the rarfiles in the current local directory to the server/ftp
Ftp> cd/ftp (Press ENTER)
Ftp> mput *. rar (Press ENTER)

4. Disconnect

Bye: the connection to the server is interrupted.

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.