Linux FTP Remote File transfer

Source: Internet
Author: User
Tags ftp ftp commands ftp site ftp client file transfer protocol

FTP commands are the user interface for a standard file Transfer protocol, and FTP is a simple and efficient way to transfer files between computers on a TCP/IP network. It allows the user to transfer both ASCII and binary files. During an FTP session, a user can connect to another computer by using an FTP client. From there, users can move up and down the directory, list the contents of the directory, copy the files from the remote machine to the local machine, and transfer the files from the local machine to the remote system. It should be noted that if the user does not have access to that file, they cannot obtain files from the remote system or transfer files to the remote system. Using FTP to transfer files, the user must know the legal username and password on the remote computer, a combination of this username/password to confirm the FTP session, and to determine what access the user has to the file to be transferred.

  The general format of the FTP command is as follows:

$ FTP host name/IP

If you do not specify a host name, FTP will give the prompt to wait for the user to enter the command:

$ ftp

FTP >

At this point, enter the Open command plus the host name or IP address at the ftp> prompt, and you will attempt to connect to the specified host. Regardless of which method is used, if the connection is successful, you need to log on to the remote machine, if the user has an account on the remote machine, you can use this account through FTP and need to provide a password. The read and write permissions on the user account on the remote machine determine what files the user can download on the remote machine and which directory to put the uploaded files in.

Once the user logs on at the remote site using FTP, a "ftp>" prompt is obtained. You are now free to use the commands provided by FTP, you can use the help command to obtain a list of available commands, or you can specify a specific command name after the help command to obtain a description of the command.

  The most commonly used commands are:

LS lists the current directory of the remote machine

CD changes working directory on remote machine

LCD changes working directory on the Local machine

ASCII settings file transfer mode is ASCII mode, by default, FTP in ASCII mode transfer files, users can also specify other modes, the ASCII and brinary command function is to set the mode of transmission, in ASCII mode transfer files to plain text is very good, However, in order to avoid the destruction of binary files, users can transfer files in binary mode.

Binary set file transfer mode to binary mode

Close terminates the current FTP session

Hash displays a # number each time the data in the data buffer is transmitted

The general format for the get Mget to transfer the specified file from the remote machine to the local call command is

Get filename

Mget command to get multiple remote files at once mget the general format of the command

Mget File Name list

Use a space-delimited or wildcard list of file names to specify which files to get, and for each of these files requires the user to confirm that they are being routed.

Put (mput) transfers the specified file from the local machine to the remote machine, and the general format of the put command is:

Put file name

Mput command sends multiple local files at once mput the general format of the command is:

Mput File Name list

Specifies the file to send using a space-delimited or wildcard list of file names, each of which requires the user to confirm whether to send them.

Open Connection Remote FTP site

Quit disconnect from the remote machine and exit FTP

? Display local Help information

! Go to the Shell

Example:

The process of transferring files using FTP is as follows

[Root@localhost root]# FTP 192.168.1.66

Connected to 192.168.1.66 (192.168.1.66).

Localhost.localdomain FTP Server (Version wu-2.6.2-5) ready.

Name (192.168.1.66:root): Test

331 Password required for test.

Password:

230 User Oracle logged in. Access Restrictions Apply

Remote system type is UNIX.

Using binary mode to transfer files.

Ftp> ls

Entering passive Mode (192.168.1.66,228,168)

Opening ASCII mode data connection for directory listing.

Total 312

-rw-r--r--1 root root 1215 Feb 4 13:49 button1.jpg

-rw-r--r--1 root root 1133 Feb 4 13:49 button2.jpg

-rw-r--r--1 root root 1435 Feb 4 13:46 index.html

Transfer complete.

ftp> LCD

Local Directory Now/root

Ftp> LCD tmp

Local Directory Now/root/tmp

Ftp> bin

Type set to I.

Ftp> mget *.jpg

Mget button1.jpg? Y

Entering passive Mode (10,153,89,66,187,198)

Opening BINARY mode data connection for button1.jpg (1215 bytes).

Transfer complete.

1215 bytes received in 0.0119 secs (1e+02 kbytes/sec)

Mget button2.jpg? Y

Entering passive Mode (10,153,89,66,243,218)

Opening BINARY mode data connection for button2.jpg (1133 bytes).

Transfer complete.

1133 Bytes received in 0.00223 secs (5e+02 kbytes/sec)

Ftp> quit

221-you have transferred 2348 bytes in 2 files.

221-total traffic for this session is 3315 bytes in 3 transfers.

221-thank for using the FTP service on Localhost.localdomain.

221 Goodbye.

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.