Detailed usage of Linux ftp commands

Source: Internet
Author: User
Tags ftp commands ftp site

The usage of Linux ftp commands is more common on the Internet. The function of Linux ftp commands is to 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 where "host name/IP" 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: $ ftpftp> 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 to change the working directory LCD to change the working directory ascii settings on the local machine File Transfer Mode to ASCII mode binary set file transfer mode to binary mode close to terminate the current each time the data in the data buffer is transmitted, the ftp session hash displays a # get (mget) transfer a specified file from a remote machine to the put (mput) on the local machine. Transfer the specified file from the local machine to the remote machine. open connection to the remote ftp site. disconnect from the remote machine and exit ftp? Displays local help information! Go to the Shell and give a brief introduction to common ftp commands. ◆ Start the ftp session open command to open a session with the remote host. The general format of this command is: ◆ open host name/IP address. If you want 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 ftp session close, disconnect, and bye commands are used to terminate sessions with remote machines. 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. ◆ 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. ◆ The remote directory list ls command lists the contents of the remote directory, just like 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 the parameter, ls will list the contents of this directory. If a local file name is provided, the directory list is put into the file you specified on the local machine. ◆ Get files from the remote system get and mget commands are used to get files from the remote machine. The general format of the get command is: get file name. You can also give 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: The mget file name list uses a space-separated or list of file names with wildcards to specify the files to be obtained. For each file, you must confirm whether to transfer the files. ◆ Send the put and mput commands to the remote system to send files to the remote machine. The general format of the Put command is: put file name mput Command sends multiple local files at a time, the general format of the mput command is: the mput file name list uses a space-separated or wildcard file name list to specify the file to be sent. You are required to confirm whether to send each file. ◆ Change the 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. ◆ When checking the transmission status to transfer large files, ftp may find it very useful to provide feedback on the transmission status. 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 directory named new_dir in the user's local 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.