Linux FTP file transmission commands

Source: Internet
Author: User
Tags ftp commands ftp file ftp site

FTP servers are more common on the Internet. Linux FTP commands use commands to control file transfer between local and remote hosts, here we will introduce some frequently used Linux FTP commands in detail. I believe it will be very easy to master these FTP operations using Linux.

The common format of Linux FTP commands is as follows:

$ FTP host name/IP Address

The "host name/IP Address" is the host name or IP address of the remote machine to be connected. In the command line, the host name is an option. If the host name is specified, FTP tries to connect to the FTP service program of the remote machine. If the host name is not specified, FTP will give a prompt, wait for the user to enter the command:
$ FTP
Ftp>
At this time, enter the open command and add the host name or IP address after the ftp> prompt to try to connect to the specified host.
No matter which method is used, if the connection is successful, You need to log on to the remote machine. If you have an account on a remote machine, you can use this account through FTP and provide a password. The read and write permissions of the user account on the remote machine determine what files the user can download and the directory to which the uploaded files are stored.
If you do not have a dedicated Logon account for a remote machine, many FTP sites have special accounts that can be used. The login name of this account is anonymous (also known as anonymous FTP). When using this account, enter the email address as the password.
If the remote system provides the anonymous FTP service, you can use this service to log on to a special directory for public use. Generally, two directories are provided: pub directory and incoming directory. The pub directory contains all the files on the site for public use. The incoming directory stores the files uploaded to the site.
Once the user successfully logs on to the remote site using FTP, the "ftp>" prompt is displayed. Now you can freely use 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 instructions on this command.

The most common commands are:
Ls to list the current directory of the remote machine
CD changes the working directory on a remote machine
LCD changes the working directory on the local machine
Set the file transmission mode to ASCII in ASCII mode.
Set the file transfer mode to binary.
Close to terminate the current FTP session
Each time the hash data is transmitted in the data buffer, A # number is displayed.
Get (mget) transfers specified files from a remote machine to a Local Machine
Put (mput) transfers the specified file from the local machine to the remote machine
Open connection to remote FTP site
Disconnect from a remote machine and exit FTP
? Display local help information
! Go to Shell

Below is a brief introduction to common FTP commands.
◆ Start an FTP session
The open command is used to open a session with the remote host. The common format of this command is:
◆ Open host name/IP Address
If you need to connect to more than one site during an FTP session, only FTP commands without parameters are used. If you only want to connect to a computer during a session, specify the remote host name or IP address on the command line as the FTP command parameter.
◆ Terminate an FTP session
The close, disconnect, and bye commands are used to terminate a session with a remote machine. Close and disronnect commands close the connection to the remote machine, but leave the user in the FTP program of the local computer. And the bye command close the connection between the user and the remote machine, and then exit the FTP program on the user machine.
◆ Change Directory
The "CD [Directory]" command is used to change the directory on the remote machine during an FTP session. The LCD command changes the local directory so that you can specify the location for searching or storing local files.
◆ Remote directory list
The LS command lists the contents of a remote directory, just like using the LS command in an interactive shell. The common format of the LS command is:
Ls [Directory] [local file]
If a directory is specified as the parameter, ls will list the contents of the directory. If a local file name is provided, the directory list is put into the file you specified on the local machine.
◆ Obtain files from a remote system
Get and mget commands are used to obtain files from a remote machine. The common format of the GET command is:
Get File Name
You can also provide a local file name, which is the name of the file to be obtained when it is created on your local machine. If you do not provide a local file name, use the original name of the remote file.
The mget command obtains multiple remote files at a time. The general format of the mget command is:
Mget File Name List
Use a list of file names separated by spaces or with wildcards to specify the file to be retrieved. For each file, you must confirm whether the file is transmitted.
◆ Send a file to a remote system
The put and mput commands are used to send files to remote machines. The general format of the PUT command is:
Put file name
The mput Command sends multiple local files at a time. The general format of the mput command is:
Mput File Name List
Use a list of file names separated by spaces or with wildcards to specify the files to be sent. You are required to confirm whether to send each file.
◆ Change file transmission mode
By default, ftp transfers files in ASCII mode. You can also specify other modes. The ASCII and brinary commands are used to set the transmission mode. Transferring files in ASCII mode is very good for plain text, but to avoid damages to binary files, users can transmit files in binary mode.
◆ Check transmission status
When transferring large files, FTP may find it useful to provide feedback on Transmission Conditions. The Hash command enables FTP to print a # character on the screen after data in the data buffer is transmitted every time. This command can be used to send and receive files.
◆ Local commands in FTP
When you use ftp, the character "!" It is used to send a command to the command shell on the local machine. It is useful if a user is in an FTP session and needs shell to do something. For example, you need to create a directory to save the received files. If you enter! Mkdir new_dir, Linux creates a new_dir
Directory.

Here, the Linux FTP command is introduced here. It should be enough to use the FTP tool in Linux.

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.