Common FTP commands under Linux 1. Connecting to an FTP server

Source: Internet
Author: User
Tags ftp commands

1. Connect to the FTP server

Format: FTP [hostname| ip-address]
A) under the Linux command line, enter:

FTP 192.168.1.1

b) The server asks for your user name and password, enter the user name and the corresponding password, respectively, to be certified.

2. Download the file

The download file usually uses the get and mget two commands.
a) Get
Format: Get [Remote-file] [Local-file]
Transfer files from the remote host to the local host.
To get/usr/your/1.htm on a remote server,

Ftp> get/usr/your/1.htm 1.htm (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/usr/your/on the server,

Ftp> cd/usr/your/
Ftp> mget * * (carriage return)


Each time you download a file, you will be prompted. If you want to remove the hint, do it before the mget. * * Command:prompt off

Note: The files are downloaded to the current directory of the Linux host. For example, the FTP command that runs under/usr/my, the files are downloaded to/usr/my.

3. Uploading Files

a) put
Format: Put Local-file [Remote-file]
Transfers a local file to the remote host.
If you want to transfer the local 1.htm to the remote host/usr/your, and renamed to 2.htm

Ftp> put 1.htm/usr/your/2.htm (carriage return)


b) mput
Format: Mput local-files
Transfers a batch of files from the local host to the remote host.
To upload all the HTML files in the local current directory to the server/usr/your/

Ftp> Cd/usr/your (carriage return)
Ftp> mput *.htm (return)


Note: The upload file is from the current directory of the host. For example, the FTP command running under/usr/my will only be uploaded to the server/usr/your under/usr/my file Linux.

4. Disconnect the connection
Bye: Interrupts the connection to the server.

ftp> Bye (carriage return)

SFTP is an interactive file transfer program. It is similar to FTP, but it is encrypted and has higher security than FTP. Below is a brief introduction of how to connect the host remotely, file upload and download, and some related operations.

For example, if the remote host IP is 202.206.64.33 or domain name www.hebust.edu.cn, the user name is Fyt, in the command line mode: SFTP [email protected] or [email protected]. Enter prompt for password. Enter the prompt

Sftp>

If you log on to the remote machine not to upload the download file, but to modify some files on the remote host. OK

SSH [email protected] (in fact, SFTP is an SSH program.) )

Sftp> get/var/www/fuyatao/index.php/home/fuyatao/
This statement will download the index.php to the local/home/fuyatao/directory from the/var/www/fuyatao/directory of the remote host.

Sftp> put/home/fuyatao/downloads/linuxgl.pdf/var/www/fuyatao/
This statement uploads the Linuxgl.pdf file under the local/home/fuyatao/downloads/directory to the remote host/var/www/fuyatao/directory.

If you do not know what the remote host directory is, the PWD command can help you query the current path of the remote host. Query native current working directory lpwd.

Change the path can be used CD, change the local path can be used LCD;

LS RM rmdir mkdir These commands are available. The same call native is add L, that is, Lls LRM.

To leave SFTP, use Exit or quit, bye. The man sftp can be consulted in detail.

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.