How to use Linux FTP commands

Source: Internet
Author: User
Tags anonymous ftp ftp commands ftp site hash requires

FTP Server is more common on the web, the function of the Linux FTP command is to control the transfer of files between the local machine and the remote machine in the way of the command, here is a detailed description of some of the Linux FTP commands often used in the command, I believe that the use of Linux for FTP operation will be very easy

The General format for Linux FTP commands is as follows:

$ FTP host name/IP

WHERE "hostname/IP" is the host name or IP address of the remote machine to which you want to connect. On the command line, the host name is an option, and if you specify a host name, FTP attempts to connect to the remote computer's FTP service program, and if no host name is specified, FTP prompts the user for a 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.

Whichever method you use, if the connection succeeds, you need to log on to the remote machine. If the user has an account number on the remote machine, he or she can use the account via 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.

If you do not have a dedicated logon account for a remote computer, many FTP sites have special accounts that you can use. This account's login name is anonymous (also known as anonymous FTP), when using this account, the request input email address as password.

If the remote system provides anonymous FTP services, users can use this service to log on to a special directory for public use. Generally provides two directories: Pub directory and incoming directory. The pub directory contains all the files that the site is intended for public use, and the incoming directory holds the files uploaded to that site.

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 setting file transfer mode to ASCII 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

Get (mget) transfer the specified file from the remote machine to the local machine

Put (mput) transfer the specified file from the local machine to the remote machine

Open Connection Remote FTP site

Disconnect from the remote machine and exit FTP

? Display local Help information

! Go to the shell

The following simple FTP commonly used commands as a brief introduction.

Start an FTP session

The Open command is used to open a session with a remote host. The general format for this command is:

Open Host name/IP

If you are connecting to more than one site during an FTP session, you typically use an FTP command with no parameters. If you want to connect to only one computer during a session, specify the remote host name or IP address as an argument to the FTP command on the command line.

Terminating an FTP session

The close, disconnect, and Bye commands terminate the session with the remote machine. The close and Disronnect commands turn off the connection to the remote machine, but use the user to stay in the FTP program on the local computer. And the bye command closes the user's connection to the remote machine, and then exits the FTP program on the user's computer.

Change Directory

The CD [directory] command changes the directory on the remote computer during an FTP session, and the LCD command changes the local directory so that users can specify where to locate or place the local files.

Remote directory List

The LS command lists the contents of the remote directory as if it were using the LS command in an interactive shell. The general format of the LS command is:

ls [directory] [local file]

If the directory is specified as an argument, then LS lists the contents of the directory. If you give the name of a local file, the directory list is placed on the local computer in the file you specify.

Getting files from a remote system

The Get and Mget commands are used to obtain files from a remote machine. The general format for the GET command is:

Get filename

You can also give a local file name, which is the file name of the file you want to get when it was created on your local machine. If you do not give a local filename, use the original name of the remote file.

The mget command gets more than one remote file at a time. The general format for the Mget command is:

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.

Sending files to a remote system

The put and Mput commands are used to send files to a remote machine. The general format of the put command is:

Put file name

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

Mput File Name list

Specify the file to send by using a space-delimited or wildcard list of file names. Each of these files requires the user to confirm whether to send them.

Change File transfer Mode

By default, FTP transfers files in ASCII mode, and users can specify other modes. The function of the ASCII and Brinary commands is to set the mode of transmission. Transferring files in ASCII mode is very good for plain text, but in order to avoid the destruction of binary files, users can transfer files in binary mode.

Check transport status

When transferring large files, you may find it useful to have FTP provide feedback about the transmission. The hash command causes FTP to print a # character on the screen after each transmission of data in the data buffer. This command can be used when sending and receiving files.

Local commands in FTP

When you use FTP, the character "!" Used to send a command to the command shell on the local machine. If the user is in an FTP session, it is useful to have the shell do something. For example, a user would like to create a directory to hold the received file. If you enter!mkdir New_dir, Linux creates a directory named New_dir in the user's current local directory.

Here Linux FTP commands are introduced here, should be enough to Linux system under the use of FTP tools.

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.