APT Package Archives and Metadata

This section provides a quick introduction on APT (Advanced Package Tool) cached archive and metadata files.

When you install a new software package with the "apt" command, the package .deb file will be downloaded and stored in the cache directory, /var/cache/apt/archives/.

herong$ ls -lt /var/cache/apt/archives/ 

total 19260
drwx------    4096 Dec 26 10:29 partial
-rw-r--r-- 4600300 Jun  8  2022 libavcodec57_7%3a3.4.11-0ubuntu0.1_amd64.deb
-rw-r--r--   75136 Jun  8  2022 libavdevice57_7%3a3.4.11-0ubuntu0.1_amd64.deb
-rw-r--r--  190580 Jun  8  2022 libavutil55_7%3a3.4.11-0ubuntu0.1_amd64.deb
-rw-r--r--   50348 Jun  8  2022 libpostproc54_7%3a3.4.11-0ubuntu0.1_amd64.deb
-rw-r--r--  874588 Jun  8  2022 libavfilter6_7%3a3.4.11-0ubuntu0.1_amd64.deb
-rw-r--r--   55240 Jun  8  2022 libswresample2_7%3a3.4.11-0ubuntu0.1_amd64.deb
-rw-r--r--  149616 Jun  8  2022 libswscale4_7%3a3.4.11-0ubuntu0.1_amd64.deb
...

Those archived package files can be removed to save disk space.

herong$ sudo apt clean 

herong$ ls -lt /var/cache/apt/archives/
total 4
drwx------ 2 _apt root 4096 Dec 26 16:44 partial
-rw-r----- 1 root root    0 Feb  9  2019 lock

"apt" also stores metadata for all packages from all APT repositories in the /var/lib/apt/lists directory.

herong$ ls -l /var/lib/apt/lists 

     4096 Feb  9  2019 auxfiles
        0 Feb  9  2019 lock
    24414 Apr 13  2022 packagecloud.io_AtomEditor_atom_any_dists_any_InRelease
   365030 Apr 13  2022 packagecloud.io_AtomEditor_atom_any_dists_any_main_binary-amd64_Pack...
    20480 Dec 26 17:14 partial
   101773 Dec 26 05:31 security.ubuntu.com_ubuntu_dists_bionic-security_InRelease
 15354252 Dec  2 06:54 security.ubuntu.com_ubuntu_dists_bionic-security_main_binary-amd64_P...
  7233376 Dec  2 06:54 security.ubuntu.com_ubuntu_dists_bionic-security_main_binary-i386_Pa...
    96704 Dec 25 22:29 security.ubuntu.com_ubuntu_dists_bionic-security_main_dep11_Componen...
    31079 Jan  5  2023 security.ubuntu.com_ubuntu_dists_bionic-security_main_dep11_icons-48...
    67887 Jan  5  2023 security.ubuntu.com_ubuntu_dists_bionic-security_main_dep11_icons-64...
 11853720 Oct 16  2024 security.ubuntu.com_ubuntu_dists_bionic-security_main_i18n_Translati...
      ... 

Do not touch these files, as they are maintained by the "apt" command.

Table of Contents

 About This Book

 Introduction to Ubuntu Systems

 GNOME - Desktop Interface and Environment

 Shell - The Command-Line Interpreter

 Process Management

 Memory Management

 Files and Directories

APT (Advanced Package Tool)

 What Is APT

 "apt list" - List Software Packages

 "apt show" - Show Software Package Details

 "sudo apt install/remove" - Install/Remove Package

 "sudo apt autoremove" - Remove Unneeded Packages

 Manage "apt" Package Repositories

 APT Configuration Settings and Overrides

APT Package Archives and Metadata

 Network Connection on Ubuntu

 Internet Networking Tools

 SSH Protocol and ssh/scp Commands

 Administrative Tasks

 References

 Full Version in PDF/EPUB