Home  >  Article  >  Operation and Maintenance  >  What to do if the ftp command cannot be used in Linux

What to do if the ftp command cannot be used in Linux

WBOY
WBOYOriginal
2022-05-09 16:05:484921browse

Solution: 1. For Red Hat system, use “yum install ftp-y” to install ftp; 2. For Debian system, use “apt install ftp -y” to install ftp; 3. For SUSE system, use “ Just type zypper install ftp" to install ftp.

What to do if the ftp command cannot be used in Linux

The operating environment of this tutorial: Red Hat 8.2&&Debian 11.0&&SUSE 15 system, Dell G3 computer.

What to do if the ftp command cannot be used in Linux

If the ftp client is not installed, it will prompt that there is no ftp command. The solution is to install the ftp software package.

The method to install the ftp software package is as follows:

1. Red Hat system

sudo yum install ftp -y

2.Debian system

sudo apt install ftp -y

3, SUSE

sudo zypper install ftp

You can use the ftp command after installation.

Extended knowledge:

1. Connect to ftp server

Format: ftp [hostname| ip-address]

a) Enter at the linux command line:

ftp 192.168.1.1

b) The server asks you for your username and password. Enter the username and corresponding password respectively, and wait until the authentication is passed. .

2. Download files

Usually use the two commands get and mget to download files.

a) get

Format: get [remote-file] [local-file]

Transfer the file from the remote host to the local host.

If you want to obtain /usr/your/1.htm on the remote server, then:

ftp> get /usr/your/1.htm 1.htm (回车)
b) mget   

Format: mget [remote-files]

Receive a file from the remote host Batch files to local host.

If you want to obtain all the files under /usr/your/ on the server, then:

ftp> cd /usr/your/
ftp> mget *.* (回车)

#At this time, there will be a prompt for each file downloaded. If you want to get rid of the prompt, execute: prompt off

before mget *.* command. Note: The files are downloaded to the current directory of the Linux host. For example, if you run the ftp command under /usr/my, the files will be downloaded to /usr/my.

3. Upload files

a) put

Format: put local-file [remote-file]

Put local A file is transferred to the remote host.

If you want to transfer the local 1.htm to the remote host /usr/your and rename it to 2.htm, then:

ftp> put 1.htm /usr/your/ 2.htm (Enter)

b) mput

Format: mput local-files

Transmit a batch of files from the local host to the remote host.

If you want to upload all html files in the current local directory to the server/usr/your/, then:

ftp> cd /usr/your (回车)
ftp> mput *.htm (回车)

#Note: The uploaded files all come from the current directory of the host. For example, if you run the ftp command under /usr/my, only the files under /usr/my will be uploaded to the server under /usr/your.

4. Disconnect

bye: Disconnect from the server.

ftp> bye (Enter)

5. Connection error:

ftp 192.168.1.1
ftp: connect: Connection refused

Solution:

[root@rac1 etc]# vsftpd /etc/vsftpd/vsftpd.conf &
[1] 9555

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of What to do if the ftp command cannot be used in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn