{"id":2123,"date":"2022-08-27T20:27:24","date_gmt":"2022-08-27T18:27:24","guid":{"rendered":"https:\/\/nguenkam.com\/blog\/?p=2123"},"modified":"2022-08-27T20:28:50","modified_gmt":"2022-08-27T18:28:50","slug":"uninstalling-packages-in-linux-with-apt-package-manager","status":"publish","type":"post","link":"https:\/\/nguenkam.com\/blog\/index.php\/2022\/08\/27\/uninstalling-packages-in-linux-with-apt-package-manager\/","title":{"rendered":"Uninstalling Packages in Linux With Apt Package Manager"},"content":{"rendered":"\n<p>we are going to learn the steps for uninstalling packages with apt from our&nbsp;<em><strong>Debian\/Ubuntu<\/strong><\/em>&nbsp;systems.<\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4>Find The Package we Want To Uninstall<\/h4>\n\n\n\n<p>First things first, we need to find the package which we want to uninstall. We can very easily locate our package\u2019s exact name with the following :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ dpkg --list | grep &lt;package-name&gt;<\/code><\/pre>\n\n\n\n<p>This helps us to locate the exact package which we would require for the future steps. Once, we have located out desired package, we can move onto the next step.<\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4>Uninstalling Packages With Apt<\/h4>\n\n\n\n<p>When talking about uninstalling packages using&nbsp;<a href=\"https:\/\/www.linuxfordevices.com\/tutorials\/linux\/apt-command-in-linux\">apt package manager<\/a>, we have the following two options :<\/p>\n\n\n\n<ul><li>remove<\/li><li>purge<\/li><\/ul>\n\n\n\n<h5>1. Using<strong><em>&nbsp;<span class=\"has-inline-color has-vivid-red-color\">apt remove<\/span><\/em><\/strong><\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo apt remove &lt;package-name&gt;<\/code><\/pre>\n\n\n\n<h5>2. Using&nbsp;<strong><em><span class=\"has-inline-color has-vivid-red-color\">apt purge<\/span><\/em><\/strong><\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo apt purge &lt;package-name&gt;<\/code><\/pre>\n\n\n\n<h4><span class=\"has-inline-color has-luminous-vivid-orange-color\">What\u2019s the difference between \u2018<strong><em>remove<\/em><\/strong>\u2018 and \u2018<strong><em>purge<\/em><\/strong>\u2018 ?<\/span><\/h4>\n\n\n\n<p>So the begging question here is \u2018<strong><em>remove<\/em><\/strong>\u2018 and \u2018<strong><em>purge<\/em><\/strong>\u2018 and when to use what ?<\/p>\n\n\n\n<p>The primary difference being \u2018<strong><em>remove<\/em><\/strong>\u2018 and \u2018<strong><em>purge<\/em><\/strong>\u2018 is that \u2018<strong><em>remove<\/em><\/strong>\u2018 only gets rid of the package leaving any configuration files untouched. Whereas \u2018<strong><em>purge<\/em><\/strong>\u2018 not only removes the package but also removes all configuration files OUTSIDE THE HOME DIRECTORY.<\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4>Post Uninstall Clean Up<\/h4>\n\n\n\n<p>At this point, we have successfully removed\/purged our package. Now, we can run some commands to perform post-removal clean up out of good practice<\/p>\n\n\n\n<p>We can clear the cache of the old\/outdated packages with :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo apt clean<\/code><\/pre>\n\n\n\n<p>We can remove unrequired packages with :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo apt autoremove<\/code><\/pre>\n\n\n\n<p>Finally, any failed\/broken installs can be fixed with :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo apt -f install<\/code><\/pre>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h5><span class=\"has-inline-color has-luminous-vivid-amber-color\"><strong>PS: (Trick)<\/strong><\/span><\/h5>\n\n\n\n<p><em>Quite contrary to what their primary function is, both \u2018<strong>purge<\/strong>\u2018 and \u2018<strong>remove<\/strong>\u2018 can be used to&nbsp;<strong>INSTALL<\/strong>&nbsp;packages. This can be achieved by appending a \u2018<strong>+<\/strong>\u2018 at the end of the package name as such&nbsp;<\/em><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo apt remove &lt;package-name&gt;+\n\/\/Or\n$ sudo apt purge &lt;package-name&gt;+<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>we are going to learn the steps for uninstalling packages with apt from our&nbsp;Debian\/Ubuntu&nbsp;systems. Find The Package we Want To Uninstall First things first, we need to find the package which we want to uninstall. We can very easily locate our package\u2019s exact name with the following : This helps us to locate the exact [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2124,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[316],"tags":[194,148,582,581,583],"_links":{"self":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/2123"}],"collection":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=2123"}],"version-history":[{"count":2,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/2123\/revisions"}],"predecessor-version":[{"id":2126,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/2123\/revisions\/2126"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/media\/2124"}],"wp:attachment":[{"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=2123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=2123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nguenkam.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=2123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}