Get the App
SLTechnology News&Howtos  ›  Servers  › 

How Debian uses apt-get for cleanup

Shulou Source: shulou.com Published: 2022-06-01 12:33:36 10月02日 Update

This article introduces the knowledge of "how Debian uses apt-get to clean up". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

It is common to run apt-get commands on Debian-based systems. Software packages are updated quite frequently, and commands such as apt-get update and apt-get upgrade make this process very easy. On the other hand, how often do you use apt-get clean, apt-get autoclean or apt-get autoremove?

These commands clean up and delete files that are still on the system but are no longer needed after the apt-get installation, usually because the program that needs them has been uninstalled.

Apt-get clean

The apt-get clean command clears the local repository of retrieved package files left in / var/cache. The directories it clears are / var/cache/apt/archives/ and / var/cache/apt/archives/partial/. The only files it leaves in / var/cache/apt/archives are the lock file and the partial subdirectory.

Before running the cleanup operation, the directory may contain many files:

/ var/cache/apt/archives/db5.3-util_5.3.28+dfsg1-0.6ubuntu1_amd64.deb/var/cache/apt/archives/db-util_1%3a5.3.21~exp1ubuntu2_all.deb/var/cache/apt/archives/lock/var/cache/apt/archives/postfix_3.4.5-1ubuntu1_amd64.deb/var/cache/apt/archives/sasl2-bin_2.1.27+dfsg-1build3_amd64.deb

After that, only these will exist:

$sudo ls-lR / var/cache/apt/archives/var/cache/apt/archives:total 4When RWMI r-1 root root 0 Jan 5 2018 lockdrwx- 2 _ apt root 4096 Nov 12 07:24 partial / var/cache/apt/archives/partial:total 0

Tags: Files commands software packages operations repositories content actually are in more directories knowledge systems processes practical frequent successful learning next practices on the other hand Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia vpn Shulou Tech Info Huawei MySQL