Two methods of Linux remote download files ftp command and SCP command __linux

Source: Internet
Author: User
Tags file copy ftp client pscp scp command

FTP command:

The server has an FTP server installed, and another Linux can use the FTP client program to copy read and download files.

1. Connecting to an FTP server
Format: FTP [hostname| ip-address]
A) on the Linux command line, enter: FTP 192.168.26.66
b The server asks you username and password, enter user name and corresponding password separately, wait for authentication to pass.

2. Download the file

The download file usually uses the get and mget two commands.
a) Get
Format: Get [Remote-file] [Local-file]
Transfers files from the remote host to the local host.
To get E:\rose\1.bmp on the server,
ftp> get/rose/1.bmp 1.bmp (carriage return)

b) mget
Format: mget [Remote-files]
Receives a batch of files from the remote host to the local host.
To get all the files under E:\rose\ on the server,
Ftp> Cd/rose
ftp> mget *.* (carriage return)

Note: The files are downloaded to the Linux host's current directory. For example, the FTP command that runs under/root/yint, the files are downloaded to the/root/yint.

3. Upload file

a) put
Format: Put Local-file [Remote-file]
Transfers a local file to the remote host.
If you want to transfer the local 1.bmp to the remote host E:\rose, and renamed to 333.bmp
Ftp> put 1.bmp/rose/333.bmp (carriage return)

b) mput
Format: Mput local-files
Transfers a batch of files from a local host to a remote host.
If you want to upload all BMP files in the local current directory to the server E:\rose
Ftp> cd/rose (carriage return)
ftp> mput *.bmp (carriage return)
Note: The upload files are from the host's current directory. For example, the FTP command that runs under the/root/test, only the file Linux under/root/test will be uploaded to the server e:\rose.

4. Disconnect the connection
Bye: Interrupts the connection to the server.
Ftp> Bye (carriage return)

SCP Command:

SCP is secure file copy, SSH based login

Suppose you want to copy a file named A.tar.tz under the local computer/home to/home/tmp on the remote server 192.168.0.2. And your account name is root on the remote server. You can use this command:
Scp/home/a.tar.tz root@192.168.0.2:/home/tmp/

If you copy the file from the remote machine to the local current directory, use this command:
SCP Root@192.168.0.2:/home/a.tar.tz

Copy files from the entire directory of the remote machine
Scp-r root@192.168.0.2:/home/*./

Source of the above content: http://www.cnblogs.com/weafer/archive/2011/06/13/2079509.html

   ----------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------

Add:

If you want to download to the Windows platform using SCP, there are two ways to do this:

1. WINSCP tool, a graphical tool

2. Putty (PSCP)

The order is as follows:

Download:

PSCP fred@example.com:/etc/hosts C:\temp\example-hosts.txt

Upload:

PSCP C:\documents\foo.txt Fred@example.com:/tmp/foo


In addition, if you use Xshell, you can also use the SZ and RZ commands to upload and download.


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.