Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Managing Debian Software with APT (apt-get etc)
Prev Home Next

3.6 Removing unused package files: apt-get clean and autoclean

When you install a package APT retrieves the needed files from the hosts listed in /etc/apt/sources.list, stores them in a local repository (/var/cache/apt/archives/), and then proceeds with installation, see Installing packages, Section 3.2.

In time the local repository can grow and occupy a lot of disk space. Fortunately, APT provides tools for managing its local repository: apt-get's clean and autoclean methods.

apt-get clean removes everything except lock files from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. Thus, if you need to reinstall a package APT should retrieve it again.

apt-get autoclean removes only package files that can no longer be downloaded.

The following example show how apt-get autoclean works:

     # ls /var/cache/apt/archives/logrotate* /var/cache/apt/archives/gpm*
     logrotate_3.5.9-7_i386.deb
     logrotate_3.5.9-8_i386.deb
     gpm_1.19.6-11_i386.deb

In /var/cache/apt/archives there are two files for the package logrotate and one for the package gpm.

     # apt-show-versions -p logrotate
     logrotate/stable uptodate 3.5.9-8
     # apt-show-versions -p gpm
     gpm/stable upgradeable from 1.19.6-11 to 1.19.6-12

apt-show-versions shows that logrotate_3.5.9-8_i386.deb provides the up to date version of logrotate, so logrotate_3.5.9-7_i386.deb is useless. Also gpm_1.19.6-11_i386.deb is useless because a more recent version of the package can be retrieved.

     # apt-get autoclean
     Reading Package Lists... Done
     Building Dependency Tree... Done
     Del gpm 1.19.6-11 [145kB]
     Del logrotate 3.5.9-7 [26.5kB]

Finally, apt-get autoclean removes only the old files. See How to upgrade packages from specific versions of Debian, Section 3.9 for more information on apt-show-versions.


Managing Debian Software with APT (apt-get etc)
Prev Home Next

 
 
  Published under the terms of the GNU General Public License Design by Interspire