{"id":7807,"date":"2021-06-28T03:25:31","date_gmt":"2021-06-28T03:25:31","guid":{"rendered":"https:\/\/linuxways.net\/?p=7807"},"modified":"2021-06-28T03:25:31","modified_gmt":"2021-06-28T03:25:31","slug":"how-to-clear-apt-cache-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-clear-apt-cache-on-ubuntu-20-04\/","title":{"rendered":"How to Clear Apt Cache on Ubuntu 20.04"},"content":{"rendered":"<h2>1. Introduction<\/h2>\n<p>Ubuntu users usually use the command apt-get to install software packages on their operating systems. Whenever they run the apt-get command, a .deb file will be saved on their local machine. This helps packages can be accessed locally, so when you need to reinstall them, it\u2019s will speed up the installation process.<\/p>\n<p>The downloaded deb files are located in \/var\/cache\/apt\/archives\/. When you run the apt-get update and apt-get install command, the apt cache will be updated.<\/p>\n<p>This tutorial will show you the way to clear the apt cache on your Ubuntu machine.<\/p>\n<h2>2. Why we need to remove the apt cache?<\/h2>\n<p>As time goes by, the cache increases so much and it will take up a lot of memory. When you removing a software package then reinstall it, your operating system will search for the local apt cache, and the same version of the software will be reinstalled.<\/p>\n<p>To list all the deb files, run:<\/p>\n<pre>$ ls \/var\/cache\/apt\/archives<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1756\" height=\"482\" class=\"wp-image-7808\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-891.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-891.png 1756w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-891-300x82.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-891-1024x281.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-891-768x211.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-891-1536x422.png 1536w\" sizes=\"auto, (max-width: 1756px) 100vw, 1756px\" \/><\/p>\n<p>In order to check how much disk space occupied by the apt cache, let\u2019s run the following command:<\/p>\n<pre>$ sudo du -sh \/var\/cache\/apt\/archives<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1082\" height=\"106\" class=\"wp-image-7809\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-892.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-892.png 1082w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-892-300x29.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-892-1024x100.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-892-768x75.png 768w\" sizes=\"auto, (max-width: 1082px) 100vw, 1082px\" \/><\/p>\n<p>It takes 110MB.<\/p>\n<h2>3. Clear the apt cache<\/h2>\n<p>It\u2019s time to clear the apt cache on your Ubuntu machine. You can simply run the following command:<\/p>\n<pre>$ sudo apt-get clean<\/pre>\n<p>Now, let\u2019s list all files in \/var\/cache\/apt\/archives again:<\/p>\n<pre>$ ls \/var\/cache\/apt\/archives<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1044\" height=\"138\" class=\"wp-image-7810\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-893.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-893.png 1044w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-893-300x40.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-893-1024x135.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-893-768x102.png 768w\" sizes=\"auto, (max-width: 1044px) 100vw, 1044px\" \/><\/p>\n<p>As you can see, all of the deb files have already been removed.<\/p>\n<h2>4. Conclusion<\/h2>\n<p>You\u2019ve already go through the steps of listing and cleaning the apt cache on your Ubuntu system.<\/p>\n<p>If you have any concerns, please let me know. Thank you for reading.<\/p>","protected":false},"excerpt":{"rendered":"<p>1. Introduction Ubuntu users usually use the command apt-get to install software packages on their operating systems. Whenever they run the apt-get command, a .deb file will be&hellip;<\/p>","protected":false},"author":1,"featured_media":7843,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[394,100],"class_list":["post-7807","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-apt-cache","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/7807","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=7807"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/7807\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/7843"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=7807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=7807"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=7807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}