1. 确认FTP软件名称
在卸载FTP软件之前,需要先确认已经安装了哪个FTP软件,因为不同FTP软件的卸载方法略有不同。可以打开控制台输入以下命令查看已安装的FTP软件:
dpkg -l | grep ftp
执行上述命令后,控制台会输出已安装的所有FTP软件,例如:
ii ftp 0.17-33 amd64 classical file transfer client
ii lftp 4.7.3-1ubuntu1 amd64 Sophisticated command-line FTP/HTTP client programs
ii vsftpd 3.0.3-12ubuntu1 amd64 lightweight, efficient FTP server written for security
由此可以看到本机上安装的FTP软件名称分别为ftp、lftp和vsftpd。
2. 使用apt-get命令卸载FTP软件
2.1 卸载ftp
如果已确认需要卸载的FTP软件名称为ftp,则可使用以下命令进行卸载:
sudo apt-get remove ftp
执行上述命令后,控制台会输出卸载ftp软件的详细信息,如下所示:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
ftp
0 upgraded, 0 newly installed, 1 to remove and 4 not upgraded.
After this operation, 197 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 274127 files and directories currently installed.)
Removing ftp (0.17-33) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
执行完毕后,ftp软件就已经被完全卸载了。
2.2 卸载lftp
如果已确认需要卸载的FTP软件名称为lftp,则可使用以下命令进行卸载:
sudo apt-get remove lftp
执行上述命令后,控制台会输出卸载lftp软件的详细信息,如下所示:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfile-copy-recursive-perl libjs-sphinxdoc liblzo2-2 libpython-all-dev libpython-dev libpython2-dev libserf-1-1 libsilc-1.1-2 linux-headers-4.15.0-99 linux-headers-4.15.0-99-generic linux-image-4.15.0-99-generic
linux-modules-4.15.0-99-generic linux-modules-extra-4.15.0-99-generic unzip
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
lftp
0 upgraded, 0 newly installed, 1 to remove and 4 not upgraded.
After this operation, 2,373 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 274123 files and directories currently installed.)
Removing lftp (4.7.3-1ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
执行完毕后,lftp软件就已经被完全卸载了。
2.3 卸载vsftpd
如果已确认需要卸载的FTP软件名称为vsftpd,则可使用以下命令进行卸载:
sudo apt-get remove vsftpd
执行上述命令后,控制台会输出卸载vsftpd软件的详细信息,如下所示:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfile-copy-recursive-perl libjs-sphinxdoc liblzo2-2 libpython-all-dev libpython-dev libpython2-dev libserf-1-1 libsilc-1.1-2 linux-headers-4.15.0-99 linux-headers-4.15.0-99-generic linux-image-4.15.0-99-generic
linux-modules-4.15.0-99-generic linux-modules-extra-4.15.0-99-generic unzip
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
vsftpd
0 upgraded, 0 newly installed, 1 to remove and 4 not upgraded.
After this operation, 124 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 274123 files and directories currently installed.)
Removing vsftpd (3.0.3-12ubuntu1) ...
Processing triggers for systemd (237-3ubuntu10.38) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
执行完毕后,vsftpd软件就已经被完全卸载了。
3. 使用dpkg命令卸载FTP软件
如果使用apt-get命令无法卸载FTP软件,可以使用dpkg命令进行卸载。以下是dpkg命令卸载FTP软件的示例:
sudo dpkg -r ftp
执行上述命令后,控制台会输出卸载ftp软件的详细信息,如下所示:
(Reading database ... 274123 files and directories currently installed.)
Removing ftp (0.17-33) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
以上示例中,ftp软件已被成功卸载。
如果使用dpkg命令卸载FTP软件时出现“未找到该软件包”的错误提示,则可以使用dpkg命令的--force-all参数进行强制卸载。以下是dpkg命令强制卸载FTP软件的示例:
sudo dpkg --force-all -r ftp
执行上述命令后,控制台会输出卸载ftp软件的详细信息,如下所示:
(Reading database ... 274123 files and directories currently installed.)
Removing ftp (0.17-33) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
以上示例中,ftp软件已被成功卸载。
4. 总结
本文介绍了Linux下三种常见FTP软件的卸载方法,包括使用apt-get命令卸载、使用dpkg命令卸载和使用dpkg命令强制卸载。这些方法适用于大部分Linux发行版,可以方便快捷地卸载多余的FTP软件,释放磁盘空间,提高系统运行效率。