Next I will use the Linux SSH command to upload files to another FTP space as an example to introduce some instance methods for uploading files using the FTP command in ssh.
If there is no ftp prompt:-bash: ftp: command not found
Install the ftp application: yum install ftp
# Ftp 127.0.0.1 21 enter the ftp ip address and port number of the remote space, and press ENTER
Enter the user name and password as prompted!
Ftp> Local LCD working directory
Ftp> cd remote directory
Ftp> binary data is transmitted in binary format.
Ftp> tick: Enable the byte counter during transmission. Run the command again to disable it.
Ftp> mput File
FTP> bye (or by) ends the ftp command parameter session with the remote computer in linux and exits the ftp command parameter in linux.
FTP> cd to change the working directory on the remote computer.
FTP> get use the current document conversion type to copy remote documents to the local computer.
Format: get remote-file [local-file]
FTP> LCD changes the working directory on the local computer. By default, the working directory is the directory for starting ftp command parameters in linux.
Format: LCD [directory]
FTP> ls displays the abbreviated list of remote directory documents and subdirectories.
FTP> mdelete delete Delete the documents on the remote computer.
Format: mdelete remote-files [...]
Description: remote-files indicates the remote document to be deleted.
FTP> mdir: displays the remote directory documentation and subdirectory list. You can use mdir to specify multiple documents.
Format: mdir remote-files [...] local-file
Description: remote-files specifies the directory to view the list. You must specify remote-files. Type-use the current working directory on the remote computer.
1. Connect to the ftp server
Format: ftp [hostname | ip-address]
A) in the linux Command Line, enter: ftp www.boluo.org
B) The server will ask you for your username and password, and enter the username and password respectively. After the authentication is passed, you can.
2. Download an object
The get and mget commands are usually used to download files:
A) get format: get [remote-file] [local-file]
Transfers files from the remote host to the local host.
To obtain/ftp/1.raron the server
Ftp> get/ftp/1.rar 1.rar (Press ENTER)
B) mget format: mget [remote-files]
Receives a batch of files from the remote host to the local host.
To obtain all files on the server or ftp
Ftp> cd/ftp
Ftp> mget *. * (Press ENTER)
Note: All files are downloaded to the current directory of the linux host.
3. upload 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.zip file to the remote host/ftp, and change it to 1.rar
Ftp> put 1.zip/ftp1.rar (Press ENTER)
B) mput format: mput local-files
Transfers a batch of files from the local host to the remote host.
To upload all the rarfiles in the current local directory to the server/ftp
Ftp> cd/ftp (Press ENTER)
Ftp> mput *. rar (Press ENTER)
4. Disconnect
Bye: the connection to the server is interrupted.