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的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!


原文地址:https://blog.csdn.net/xuchaoxin1375/article/details/124502453
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.chinasem.cn/article/211384

相关文章

Linux CPU飙升排查五步法解读

《LinuxCPU飙升排查五步法解读》:本文主要介绍LinuxCPU飙升排查五步法,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录排查思路-五步法1. top命令定位应用进程pid2.php top-Hp[pid]定位应用进程对应的线程tid3. printf"%

Linux下安装Anaconda3全过程

《Linux下安装Anaconda3全过程》:本文主要介绍Linux下安装Anaconda3全过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录简介环境下载安装一、找到下载好的文件名为Anaconda3-2018.12-linux-x86_64的安装包二、或者通

使用Python实现Windows系统垃圾清理

《使用Python实现Windows系统垃圾清理》Windows自带的磁盘清理工具功能有限,无法深度清理各类垃圾文件,所以本文为大家介绍了如何使用Python+PyQt5开发一个Windows系统垃圾... 目录一、开发背景与工具概述1.1 为什么需要专业清理工具1.2 工具设计理念二、工具核心功能解析2.

Linux系统之stress-ng测压工具的使用

《Linux系统之stress-ng测压工具的使用》:本文主要介绍Linux系统之stress-ng测压工具的使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、理论1.stress工具简介与安装2.语法及参数3.具体安装二、实验1.运行8 cpu, 4 fo

Java实现本地缓存的常用方案介绍

《Java实现本地缓存的常用方案介绍》本地缓存的代表技术主要有HashMap,GuavaCache,Caffeine和Encahche,这篇文章主要来和大家聊聊java利用这些技术分别实现本地缓存的方... 目录本地缓存实现方式HashMapConcurrentHashMapGuava CacheCaffe

Linux lvm实例之如何创建一个专用于MySQL数据存储的LVM卷组

《Linuxlvm实例之如何创建一个专用于MySQL数据存储的LVM卷组》:本文主要介绍使用Linux创建一个专用于MySQL数据存储的LVM卷组的实例,具有很好的参考价值,希望对大家有所帮助,... 目录在Centos 7上创建卷China编程组并配置mysql数据目录1. 检查现有磁盘2. 创建物理卷3. 创

Nacos日志与Raft的数据清理指南

《Nacos日志与Raft的数据清理指南》随着运行时间的增长,Nacos的日志文件(logs/)和Raft持久化数据(data/protocol/raft/)可能会占用大量磁盘空间,影响系统稳定性,本... 目录引言1. Nacos 日志文件(logs/ 目录)清理1.1 日志文件的作用1.2 是否可以删除

Linux查看系统盘和SSD盘的容量、型号及挂载信息的方法

《Linux查看系统盘和SSD盘的容量、型号及挂载信息的方法》在Linux系统中,管理磁盘设备和分区是日常运维工作的重要部分,而lsblk命令是一个强大的工具,它用于列出系统中的块设备(blockde... 目录1. 查看所有磁盘的物理信息方法 1:使用 lsblk(推荐)方法 2:使用 fdisk -l(

Linux中的more 和 less区别对比分析

《Linux中的more和less区别对比分析》在Linux/Unix系统中,more和less都是用于分页查看文本文件的命令,但less是more的增强版,功能更强大,:本文主要介绍Linu... 目录1. 基础功能对比2. 常用操作对比less 的操作3. 实际使用示例4. 为什么推荐 less?5.

如何更改pycharm缓存路径和虚拟内存分页文件位置(c盘爆红)

《如何更改pycharm缓存路径和虚拟内存分页文件位置(c盘爆红)》:本文主要介绍如何更改pycharm缓存路径和虚拟内存分页文件位置(c盘爆红)问题,具有很好的参考价值,希望对大家有所帮助,如有... 目录先在你打算存放的地方建四个文件夹更改这四个路径就可以修改默认虚拟内存分页js文件的位置接下来从高级-