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命令之firewalld的用法

《Linux命令之firewalld的用法》:本文主要介绍Linux命令之firewalld的用法,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux命令之firewalld1、程序包2、启动firewalld3、配置文件4、firewalld规则定义的九大

MySQL索引的优化之LIKE模糊查询功能实现

《MySQL索引的优化之LIKE模糊查询功能实现》:本文主要介绍MySQL索引的优化之LIKE模糊查询功能实现,本文通过示例代码给大家介绍的非常详细,感兴趣的朋友一起看看吧... 目录一、前缀匹配优化二、后缀匹配优化三、中间匹配优化四、覆盖索引优化五、减少查询范围六、避免通配符开头七、使用外部搜索引擎八、分

Linux之计划任务和调度命令at/cron详解

《Linux之计划任务和调度命令at/cron详解》:本文主要介绍Linux之计划任务和调度命令at/cron的使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux计划任务和调度命令at/cron一、计划任务二、命令{at}介绍三、命令语法及功能 :at

Linux下如何使用C++获取硬件信息

《Linux下如何使用C++获取硬件信息》这篇文章主要为大家详细介绍了如何使用C++实现获取CPU,主板,磁盘,BIOS信息等硬件信息,文中的示例代码讲解详细,感兴趣的小伙伴可以了解下... 目录方法获取CPU信息:读取"/proc/cpuinfo"文件获取磁盘信息:读取"/proc/diskstats"文

Linux内核参数配置与验证详细指南

《Linux内核参数配置与验证详细指南》在Linux系统运维和性能优化中,内核参数(sysctl)的配置至关重要,本文主要来聊聊如何配置与验证这些Linux内核参数,希望对大家有一定的帮助... 目录1. 引言2. 内核参数的作用3. 如何设置内核参数3.1 临时设置(重启失效)3.2 永久设置(重启仍生效

python logging模块详解及其日志定时清理方式

《pythonlogging模块详解及其日志定时清理方式》:本文主要介绍pythonlogging模块详解及其日志定时清理方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地... 目录python logging模块及日志定时清理1.创建logger对象2.logging.basicCo

如何将Python彻底卸载的三种方法

《如何将Python彻底卸载的三种方法》通常我们在一些软件的使用上有碰壁,第一反应就是卸载重装,所以有小伙伴就问我Python怎么卸载才能彻底卸载干净,今天这篇文章,小编就来教大家如何彻底卸载Pyth... 目录软件卸载①方法:②方法:③方法:清理相关文件夹软件卸载①方法:首先,在安装python时,下

SQL表间关联查询实例详解

《SQL表间关联查询实例详解》本文主要讲解SQL语句中常用的表间关联查询方式,包括:左连接(leftjoin)、右连接(rightjoin)、全连接(fulljoin)、内连接(innerjoin)、... 目录简介样例准备左外连接右外连接全外连接内连接交叉连接自然连接简介本文主要讲解SQL语句中常用的表

kali linux 无法登录root的问题及解决方法

《kalilinux无法登录root的问题及解决方法》:本文主要介绍kalilinux无法登录root的问题及解决方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,... 目录kali linux 无法登录root1、问题描述1.1、本地登录root1.2、ssh远程登录root2、

前端下载文件时如何后端返回的文件流一些常见方法

《前端下载文件时如何后端返回的文件流一些常见方法》:本文主要介绍前端下载文件时如何后端返回的文件流一些常见方法,包括使用Blob和URL.createObjectURL创建下载链接,以及处理带有C... 目录1. 使用 Blob 和 URL.createObjectURL 创建下载链接例子:使用 Blob