Raspberry Pi_Eng_17.6.2 Cleaning Program Package File


Published Book on Amazon


All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2


출판된 한글판 도서


최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상)
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하)


Original Book Contents


17.6.2  Cleaning Program Package File

 

During the process of installing or upgrading programs, the related program package file is downloaded and stored in the local repository "/var/cache/apt/archives/". These files are not deleted and remain intact even if the program installation is completed or the program is removed. If these files continue to accumulate, it will take up unnecessary storage space in the system, so it's a good idea to remove any files that is no longer needed.

 

Note that deleting the program package file in the local repository does not remove the program already installed on the system, so it does not interfere with the normal execution of the installed program.

 

17.6.2.1    "apt-get clean" Command

 

To remove the package file that was downloaded during package installation, use "clean" command in "apt-get" command.

 

[Command Format]

apt-get  clean  

 

[Command Overview]

   This deletes the downloaded archive files.

   User privilege          -- Super user.

 

[Detail Description]

   The "clean" command removes the downloaded package archive and free up space.

   This command removes everything except the lock file from the cache directory "/var/cache/apt/archives/" and "/var/cache/apt/archives/partial/".

 

[Used Example]

The following is an example of removing unnecessary package files from the system.

 

pi@raspberrypi:~ $ sudo apt-get clean

 


 

17.6.2.2    "apt-get autoclean" Command

 

You may need to delete only the files that are no longer used, rather than delete all the data, as some of the package files downloaded during the installation of the package may still need to be used. To do work in this way, use "autoclean" command in "apt-get" command.

 

[Command Format]

apt-get   autoclean

 

[Command Overview]

   This deletes only the oldest of the downloaded archive files.

   User privilege          -- Super user.

 

[Detail Description]

   The "autoclean" removes the package files found in the local cache directory, similar to "clean". The difference is that "autoclean" only removes obsolete downloaded package files because they are no longer used. In other words, it retains the latest package at the current point of time intact, but deletes the old package.

 

[Used Example]

The following is an example of running a command that removes a download package file that is no longer needed on the system.

 

pi@raspberrypi:~ $ sudo apt-get autoclean

Reading package lists... Done

Building dependency tree

Reading state information... Done