linux_apt 卸载清理/包检查/完整包名查询/清理已经下载的包缓存(被打断的下载)/remove/purge/autoremove/autoclean

本文主要是介绍linux_apt 卸载清理/包检查/完整包名查询/清理已经下载的包缓存(被打断的下载)/remove/purge/autoremove/autoclean,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文章目录

  • linux_apt 卸载清理
    • apt 清理相关命令
      • 示例(卸载与清理)
      • purge and autoremove
      • for example:
    • 一步到位(sudo apt --purge autoremove)
    • 逐步操作
    • Remove a package:(step by step)
      • Get the package complete name:(完整包名查询)
    • 清理apt下载的包缓存

linux_apt 卸载清理

  • uninstall - How can you completely remove a package? - Ask Ubuntu
  • 技术|如何清除 APT 缓存来回收宝贵的磁盘空间 (linux.cn)

apt 清理相关命令

  • 卸载某个包(apt remove)

  • apt autoremove

    • 清理依赖

    • autoremove (apt-get(8))autoremove is used to remove packages that were automatically installed tosatisfy dependencies for other packages and are now no longer needed asdependencies changed or the package(s) needing them were removed in themeantime.
      

示例(卸载与清理)

# cxxu_kali @ CxxuWin11 in ~ [20:09:02]
$ sudo apt list --installed|grep python
libpython3.9-dev/kali-rolling,now 3.9.12-1 amd64 [installed,automatic]
libpython3.9-minimal/kali-rolling,now 3.9.12-1 amd64 [installed,automatic]
libpython3.9-stdlib/kali-rolling,now 3.9.12-1 amd64 [installed,automatic]
libpython3.9/kali-rolling,now 3.9.12-1 amd64 [installed,automatic]
python3-dev/kali-rolling,now 3.9.8-1 amd64 [installed,automatic]
python3-distutils/kali-rolling,now 3.9.10-1 all [installed,automatic]
python3-lib2to3/kali-rolling,now 3.9.10-1 all [installed,automatic]
python3-minimal/kali-rolling,now 3.9.8-1 amd64 [installed,automatic]
python3-pip/kali-rolling,now 22.0.2+dfsg-1 all [installed]
python3-pkg-resources/kali-rolling,now 59.6.0-1.2 all [installed,automatic]
python3-setuptools/kali-rolling,now 59.6.0-1.2 all [installed,automatic]
python3-wheel/kali-rolling,now 0.37.1-2 all [installed,automatic]
python3.10-minimal/kali-rolling,now 3.10.2-1 amd64 [installed,auto-removable]
python3.9-dev/kali-rolling,now 3.9.12-1 amd64 [installed,automatic]
python3.9-minimal/kali-rolling,now 3.9.12-1 amd64 [installed,automatic]
python3.9/kali-rolling,now 3.9.12-1 amd64 [installed]
python3/kali-rolling,now 3.9.8-1 amd64 [installed,automatic]# cxxu_kali @ CxxuWin11 in ~ [20:09:15]
$ sudo apt autoclean
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Del git-man 1:2.34.1-1 [1,903 kB]
Del git 1:2.34.1-1 [5,738 kB]
Del libcurl3-gnutls 7.81.0-1 [353 kB]
Del libexpat1 2.4.4-1 [106 kB]
Del openssh-client 1:8.8p1-1 [1,040 kB]# cxxu_kali @ CxxuWin11 in ~ [20:10:47]
$ sudo apt autoremove
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:libpython3.10-minimal libpython3.10-stdlib python3.10-minimal
0 upgraded, 0 newly installed, 3 to remove and 109 not upgraded.
After this operation, 19.0 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 39390 files and directories currently installed.)
Removing libpython3.10-stdlib:amd64 (3.10.2-1) ...
Removing python3.10-minimal (3.10.2-1) ...
Unlinking and removing bytecode for runtime python3.10
Removing libpython3.10-minimal:amd64 (3.10.2-1) ...
Processing triggers for man-db (2.10.2-1) ...# cxxu_kali @ CxxuWin11 in ~ [20:10:58]
$ sudo apt autoremove# cxxu_kali @ CxxuWin11 in ~ [20:11:15] C:130
$ sudo apt list --installed|grep pythonWARNING: apt does not have a stable CLI interface. Use with caution in scripts.libpython3-dev/kali-rolling,now 3.9.8-1 amd64 [installed,automatic]
libpython3-stdlib/kali-rolling,now 3.9.8-1 amd64 [installed,automatic]
libpython3.9-dev/kali-rolling,now 3.9.12-1 amd64 [installed,automatic]
libpython3.9-minimal/kali-rolling,now 3.9.12-1 amd64 [installed,automatic]
libpython3.9-stdlib/kali-rolling,now 3.9.12-1 amd64 [installed,automatic]
libpython3.9/kali-rolling,now 3.9.12-1 amd64 [installed,automatic]
python3-dev/kali-rolling,now 3.9.8-1 amd64 [installed,automatic]
python3-distutils/kali-rolling,now 3.9.10-1 all [installed,automatic]
python3-lib2to3/kali-rolling,now 3.9.10-1 all [installed,automatic]
python3-minimal/kali-rolling,now 3.9.8-1 amd64 [installed,automatic]
python3-pip/kali-rolling,now 22.0.2+dfsg-1 all [installed]
python3-pkg-resources/kali-rolling,now 59.6.0-1.2 all [installed,automatic]
python3-setuptools/kali-rolling,now 59.6.0-1.2 all [installed,automatic]
python3-wheel/kali-rolling,now 0.37.1-2 all [installed,automatic]
python3.9-dev/kali-rolling,now 3.9.12-1 amd64 [installed,automatic]
python3.9-minimal/kali-rolling,now 3.9.12-1 amd64 [installed,automatic]
python3.9/kali-rolling,now 3.9.12-1 amd64 [installed]
python3/kali-rolling,now 3.9.8-1 amd64 [installed,automatic]# cxxu_kali @ CxxuWin11 in ~ [20:11:17]

purge and autoremove

This is a very general answer to the question about the effects of purging packages. For advice specific to your situation, you’ll have to edit your question to include additional information–in particular, the complete and exact text of the error message you are getting.*

Removing packages with sudo apt purge ***...\*** or sudo apt --purge remove ***...\*** will remove them and all their global (i.e., systemwide) configuration files. This is usually what people mean when they talk about completely removing a package.

But that doesn’t mean your system is the same as it was before the package was installed. In particular:

  • This does not remove packages that were installed as dependencies, when you installed the package you’re now removing. Assuming those packages aren’t dependencies of any other packages, and that you haven’t marked them as manually installed, you can remove the dependencies with sudo apt autoremove or (if you want to delete their systemwide configuration files too) sudo apt --purge autoremove.

for example:

  • try to remove python3.9 completely
# cxxu_kali @ CxxuWin11 in ~ [20:21:58]
$ sudo apt purge python3.9
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:javascript-common libexpat1-dev libjs-jquery libjs-sphinxdoc libjs-underscore libmpdec3libpython3-dev libpython3-stdlib libpython3.9 libpython3.9-dev libpython3.9-minimallibpython3.9-stdlib media-types python3-minimal python3.9-minimal zlib1g-dev
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:python3* python3-dev* python3-distutils* python3-lib2to3* python3-pip*python3-pkg-resources* python3-setuptools* python3-wheel* python3.9* python3.9-dev*
0 upgraded, 0 newly installed, 10 to remove and 109 not upgraded.
After this operation, 12.1 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 38760 files and directories currently installed.)
Removing python3-dev (3.9.8-1) ...
Removing python3-pip (22.0.2+dfsg-1) ...
Removing python3-wheel (0.37.1-2) ...
Removing python3-setuptools (59.6.0-1.2) ...
Removing python3-distutils (3.9.10-1) ...
Removing python3-pkg-resources (59.6.0-1.2) ...
Removing python3-lib2to3 (3.9.10-1) ...
dpkg: warning: while removing python3-lib2to3, directory '/usr/lib/python3.10' not empty so not removed
Removing python3.9-dev (3.9.12-1) ...
Removing python3 (3.9.8-1) ...
Removing python3.9 (3.9.12-1) ...
Processing triggers for man-db (2.10.2-1) ...
(Reading database ... 37530 files and directories currently installed.)
Purging configuration files for python3 (3.9.8-1) ...#remove the dependencies# cxxu_kali @ CxxuWin11 in ~ [20:22:11]
$ sudo apt list --installed|grep pythonWARNING: apt does not have a stable CLI interface. Use with caution in scripts.libpython3-dev/kali-rolling,now 3.9.8-1 amd64 [installed,auto-removable]
libpython3-stdlib/kali-rolling,now 3.9.8-1 amd64 [installed,auto-removable]
libpython3.9-dev/kali-rolling,now 3.9.12-1 amd64 [installed,auto-removable]
libpython3.9-minimal/kali-rolling,now 3.9.12-1 amd64 [installed,auto-removable]
libpython3.9-stdlib/kali-rolling,now 3.9.12-1 amd64 [installed,auto-removable]
libpython3.9/kali-rolling,now 3.9.12-1 amd64 [installed,auto-removable]
python3-minimal/kali-rolling,now 3.9.8-1 amd64 [installed,auto-removable]
python3.9-minimal/kali-rolling,now 3.9.12-1 amd64 [installed,auto-removable]

一步到位(sudo apt --purge autoremove)

适用于全新的卸载操作

  • sudo apt-get purge --auto-remove packagename

逐步操作

  • 之前未卸载干净时的清理
    • remove
    • purge
    • autoremove
    • autoclean

Remove a package:(step by step)

Get the package complete name:(完整包名查询)

dpkg --list | grep partial_package_name*
  • Remove the package:
sudo apt-get remove package_name
  • Remove all the dependencies:
sudo apt-get purge package_name
  • Remove the unneeded packages that were once installed as a dependency:
sudo apt-get autoremove
  • Remove the retrieved packages from the local cache:
sudo apt-get autoclean
  • Check that it was completely removed:
dpkg --list | grep partial_package_name*

清理apt下载的包缓存

  • cd /var/cache/apt/archives
    在这里插入图片描述
  • 在该目录下删除deb文件

这篇关于linux_apt 卸载清理/包检查/完整包名查询/清理已经下载的包缓存(被打断的下载)/remove/purge/autoremove/autoclean的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/211384

相关文章

Linux中shell解析脚本的通配符、元字符、转义符说明

《Linux中shell解析脚本的通配符、元字符、转义符说明》:本文主要介绍shell通配符、元字符、转义符以及shell解析脚本的过程,通配符用于路径扩展,元字符用于多命令分割,转义符用于将特殊... 目录一、linux shell通配符(wildcard)二、shell元字符(特殊字符 Meta)三、s

Linux之软件包管理器yum详解

《Linux之软件包管理器yum详解》文章介绍了现代类Unix操作系统中软件包管理和包存储库的工作原理,以及如何使用包管理器如yum来安装、更新和卸载软件,文章还介绍了如何配置yum源,更新系统软件包... 目录软件包yumyum语法yum常用命令yum源配置文件介绍更新yum源查看已经安装软件的方法总结软

linux报错INFO:task xxxxxx:634 blocked for more than 120 seconds.三种解决方式

《linux报错INFO:taskxxxxxx:634blockedformorethan120seconds.三种解决方式》文章描述了一个Linux最小系统运行时出现的“hung_ta... 目录1.问题描述2.解决办法2.1 缩小文件系统缓存大小2.2 修改系统IO调度策略2.3 取消120秒时间限制3

Linux alias的三种使用场景方式

《Linuxalias的三种使用场景方式》文章介绍了Linux中`alias`命令的三种使用场景:临时别名、用户级别别名和系统级别别名,临时别名仅在当前终端有效,用户级别别名在当前用户下所有终端有效... 目录linux alias三种使用场景一次性适用于当前用户全局生效,所有用户都可调用删除总结Linux

Linux:alias如何设置永久生效

《Linux:alias如何设置永久生效》在Linux中设置别名永久生效的步骤包括:在/root/.bashrc文件中配置别名,保存并退出,然后使用source命令(或点命令)使配置立即生效,这样,别... 目录linux:alias设置永久生效步骤保存退出后功能总结Linux:alias设置永久生效步骤

Oracle查询优化之高效实现仅查询前10条记录的方法与实践

《Oracle查询优化之高效实现仅查询前10条记录的方法与实践》:本文主要介绍Oracle查询优化之高效实现仅查询前10条记录的相关资料,包括使用ROWNUM、ROW_NUMBER()函数、FET... 目录1. 使用 ROWNUM 查询2. 使用 ROW_NUMBER() 函数3. 使用 FETCH FI

数据库oracle用户密码过期查询及解决方案

《数据库oracle用户密码过期查询及解决方案》:本文主要介绍如何处理ORACLE数据库用户密码过期和修改密码期限的问题,包括创建用户、赋予权限、修改密码、解锁用户和设置密码期限,文中通过代码介绍... 目录前言一、创建用户、赋予权限、修改密码、解锁用户和设置期限二、查询用户密码期限和过期后的修改1.查询用

Linux使用fdisk进行磁盘的相关操作

《Linux使用fdisk进行磁盘的相关操作》fdisk命令是Linux中用于管理磁盘分区的强大文本实用程序,这篇文章主要为大家详细介绍了如何使用fdisk进行磁盘的相关操作,需要的可以了解下... 目录简介基本语法示例用法列出所有分区查看指定磁盘的区分管理指定的磁盘进入交互式模式创建一个新的分区删除一个存

Linux使用dd命令来复制和转换数据的操作方法

《Linux使用dd命令来复制和转换数据的操作方法》Linux中的dd命令是一个功能强大的数据复制和转换实用程序,它以较低级别运行,通常用于创建可启动的USB驱动器、克隆磁盘和生成随机数据等任务,本文... 目录简介功能和能力语法常用选项示例用法基础用法创建可启动www.chinasem.cn的 USB 驱动

使用SQL语言查询多个Excel表格的操作方法

《使用SQL语言查询多个Excel表格的操作方法》本文介绍了如何使用SQL语言查询多个Excel表格,通过将所有Excel表格放入一个.xlsx文件中,并使用pandas和pandasql库进行读取和... 目录如何用SQL语言查询多个Excel表格如何使用sql查询excel内容1. 简介2. 实现思路3