1 00:00:00,120 --> 00:00:01,380 Hello, you beautiful people. 2 00:00:01,450 --> 00:00:03,780 Now, as you know, there are two sides to every coin. 3 00:00:03,780 --> 00:00:07,290 And now that you've learned how to install packages to your system in this video, we're going to be 4 00:00:07,290 --> 00:00:11,910 covering how you can uninstall packages from your system and make sure that your system is squeaky clean. 5 00:00:11,910 --> 00:00:14,400 So let's just go ahead and get right into it. 6 00:00:15,680 --> 00:00:15,970 Okay. 7 00:00:16,070 --> 00:00:20,480 So in the last few videos we've been messing around with the X11 apps package and we're going to continue 8 00:00:20,480 --> 00:00:23,410 using that as kind of our guinea pig for this video. 9 00:00:23,420 --> 00:00:30,530 So to uninstall a package in Ubuntu, the most basic way to do it is to type sudo apt get remove and 10 00:00:30,530 --> 00:00:31,550 then the package name. 11 00:00:31,550 --> 00:00:31,870 Okay. 12 00:00:31,970 --> 00:00:38,420 So because we are talking about the X11 apps package, we just type pseudo app to get remove and then 13 00:00:38,420 --> 00:00:40,760 X11 apps and that would remove it. 14 00:00:40,760 --> 00:00:42,770 But that's not the preferred way to do it. 15 00:00:42,980 --> 00:00:47,420 And the reason is when you install packages, there are sometimes configuration files that come along 16 00:00:47,420 --> 00:00:52,550 with the packages and if you just remove the package using pseudo app to get remove, then the configuration 17 00:00:52,550 --> 00:00:56,300 files are left behind on your system, taking up space and not being helpful. 18 00:00:56,360 --> 00:01:00,710 Now this can be useful if you want to install the package again in the future and want all your settings 19 00:01:00,710 --> 00:01:01,430 to be the same. 20 00:01:01,430 --> 00:01:03,890 But it's still not really the preferred way to do it. 21 00:01:03,890 --> 00:01:07,430 Instead, to remove a package and all of its configuration files. 22 00:01:07,430 --> 00:01:13,040 What we do is instead of typing sudo app get removed we type sudo apt get purge and then the package 23 00:01:13,040 --> 00:01:13,310 name. 24 00:01:13,520 --> 00:01:16,190 So sudo app get purge X11 apps. 25 00:01:16,190 --> 00:01:19,730 Now the purge will remove the package and its configuration files. 26 00:01:19,730 --> 00:01:23,270 So always use Purge whenever you want to uninstall a package. 27 00:01:23,270 --> 00:01:28,670 So if I go ahead and do that, it's going to go and say, hey, I want to remove this. 28 00:01:28,700 --> 00:01:29,360 Is that okay? 29 00:01:29,360 --> 00:01:30,470 I press Yes. 30 00:01:31,610 --> 00:01:36,320 And it will go through and remove X11 apps and any of its configuration file. 31 00:01:36,320 --> 00:01:40,340 So you can see here it says purging configuration files for X11 apps. 32 00:01:40,760 --> 00:01:42,850 So it's gone ahead and done that. 33 00:01:42,860 --> 00:01:47,480 Now that will have the X 11 apps package 100% removed from the system. 34 00:01:47,540 --> 00:01:52,520 But sometimes when you install packages, you need to install like ten of the different packages as 35 00:01:52,520 --> 00:01:53,360 dependencies. 36 00:01:53,780 --> 00:01:59,090 So you need in order to get the package that you want to install to work, you need like ten other packages 37 00:01:59,090 --> 00:02:02,270 or maybe even 100 of the packages in order to get that one package to work. 38 00:02:02,270 --> 00:02:05,060 And we call those extra packages dependencies. 39 00:02:05,060 --> 00:02:09,410 So if those dependencies are no longer required, but you don't know what they're called, how can you 40 00:02:09,410 --> 00:02:10,100 remove them? 41 00:02:10,220 --> 00:02:14,600 Well, you're in luck in order to remove packages that were installed as dependencies but are no longer 42 00:02:14,600 --> 00:02:16,580 required for any other package on the system. 43 00:02:16,580 --> 00:02:24,350 You can just do sudo if i click the screen sudo apt get auto remove and that's it. 44 00:02:24,470 --> 00:02:26,270 So sudo apt get auto remove. 45 00:02:26,270 --> 00:02:31,670 Now auto remove will automatically remove any dangling dependencies that are no longer required, which 46 00:02:31,670 --> 00:02:33,380 helps you save space on your system. 47 00:02:33,380 --> 00:02:37,760 So if I do that, it's going to tell me there's actually not any that need to be removed. 48 00:02:37,760 --> 00:02:39,860 But you can save a lot of space in this. 49 00:02:39,860 --> 00:02:43,700 So bear in mind, this is all happening across hundreds or even thousands of different packages on your 50 00:02:43,700 --> 00:02:44,240 system. 51 00:02:44,240 --> 00:02:49,000 And having the package manager keep everything in order automatically is a really great asset. 52 00:02:49,010 --> 00:02:52,070 I'm sure you'd agree it beats doing it yourself anyway. 53 00:02:52,100 --> 00:02:57,920 Now whenever you download and install the package, a copy of the package is saved locally on your computer. 54 00:02:57,950 --> 00:03:01,910 Now this package is then unpacked and installed on your system, so that's how it works when you install 55 00:03:01,910 --> 00:03:07,310 a package, downloads itself as a compressed archive, then unpacks itself and installs itself on your 56 00:03:07,310 --> 00:03:07,670 system. 57 00:03:07,670 --> 00:03:12,110 Okay, now, because of that two step process, not only is a package installed on your system, but 58 00:03:12,110 --> 00:03:14,300 a compressed version of it is also saved. 59 00:03:14,450 --> 00:03:19,040 Now, these compressed files usually take up space and aren't really necessary if you already have the 60 00:03:19,040 --> 00:03:21,710 package installed because they're just, you know, an archive. 61 00:03:21,710 --> 00:03:23,420 They're like the wrapper that comes with the stuff. 62 00:03:23,420 --> 00:03:23,890 Okay. 63 00:03:24,440 --> 00:03:29,210 So you can actually save yourself massive amounts of space, sometimes even gigabytes of space, just 64 00:03:29,210 --> 00:03:30,800 by deleting these archives. 65 00:03:31,250 --> 00:03:32,690 Now these archives are stored. 66 00:03:32,990 --> 00:03:38,900 If I, if we go there slash, var, slash cache, slash, apt slash archive. 67 00:03:38,900 --> 00:03:44,540 So if we go there and take a look, we can see there's quite a few little DB files here, some compressed 68 00:03:44,540 --> 00:03:49,520 archives saved in there and you can see the 14x 11 APS, even though we've actually removed it from 69 00:03:49,520 --> 00:03:50,150 the system. 70 00:03:50,150 --> 00:03:56,210 And you can see how large these are by doing LS with the L command and you can see that there's a total 71 00:03:56,210 --> 00:03:57,620 of about ten megabytes in there. 72 00:03:57,620 --> 00:04:03,080 Now, that's not much, but you know, this can easily grow to gigabytes after you keep installing packages 73 00:04:03,080 --> 00:04:03,590 on your system. 74 00:04:03,590 --> 00:04:08,750 It can get quite mad because every package you install comes with its own dependencies and even those 75 00:04:08,750 --> 00:04:10,940 dependencies are saved as copy. 76 00:04:10,940 --> 00:04:14,540 So you can really save a lot of space by removing the stuff from here. 77 00:04:14,570 --> 00:04:16,910 Now you don't have to even be in the folder to remove them. 78 00:04:16,910 --> 00:04:20,180 So if I just head back to our home directory, as you can see, we're in our home directory. 79 00:04:20,269 --> 00:04:27,650 If we run sudo apt get clean, that will delete all of the packages from that directory. 80 00:04:27,650 --> 00:04:34,610 So if we head back up into the slash var slash cache, slash apt slash archives and do an LS, we can 81 00:04:34,610 --> 00:04:37,700 see the now that have all been deleted even though we weren't in that folder. 82 00:04:37,700 --> 00:04:41,450 So if you want to get rid of all that stuff, do sudo apt get clean. 83 00:04:41,810 --> 00:04:45,830 But sometimes you don't want to delete all of those for whatever reason and you only want to get rid 84 00:04:45,830 --> 00:04:46,580 of the stuff. 85 00:04:46,820 --> 00:04:52,370 You want to get rid of those packages, those, those, those archives. 86 00:04:52,370 --> 00:04:58,100 But the ones for packages that can no longer be accessed from the from the actual Ubuntu repositories. 87 00:04:58,100 --> 00:05:02,660 Now this is usually for systems that are very old and want to keep their cache going for years and years 88 00:05:02,660 --> 00:05:06,950 and years and every now and then just, you know, trim the leaves and get rid of their dead packages 89 00:05:06,950 --> 00:05:09,050 that can no longer be downloaded for whatever reason. 90 00:05:09,050 --> 00:05:15,710 And to do that, instead of using pseudo apt get clean, you use auto clean now as just to highlight 91 00:05:15,710 --> 00:05:20,060 clean gets rid of everything of of those in the archive cache. 92 00:05:20,060 --> 00:05:24,620 Now that's different from the from the list cache by the way that's just a this is just a storage space 93 00:05:24,620 --> 00:05:28,160 for, for saved archives and packages and stuff. 94 00:05:28,160 --> 00:05:33,740 So this is a completely different cache, but clean will remove everything in there and auto clean will 95 00:05:33,740 --> 00:05:37,580 check what's in there and only delete the ones that you can no longer download from the repositories 96 00:05:37,580 --> 00:05:40,700 to make sure you don't have stuff in there that you'll never use again. 97 00:05:41,880 --> 00:05:42,720 So there you have it. 98 00:05:42,720 --> 00:05:45,480 A no nonsense guide to uninstalling packages. 99 00:05:45,480 --> 00:05:46,620 So let's review. 100 00:05:46,890 --> 00:05:47,430 We discuss it. 101 00:05:47,430 --> 00:05:53,310 The most basic way to review packages is to use sudo apt get remove and then the package name. 102 00:05:53,310 --> 00:06:00,240 But this is not recommended because it leaves behind configuration files instead use sudo apt get purge 103 00:06:00,240 --> 00:06:01,350 and then the package name. 104 00:06:01,860 --> 00:06:06,540 Now when you install the package, it's likely that other dependency packages were also installed in 105 00:06:06,540 --> 00:06:11,580 order to make that package work and in order to get rid of those dependencies and automatically remove 106 00:06:11,580 --> 00:06:13,890 them from the system as long as they're no longer required. 107 00:06:13,890 --> 00:06:20,460 You would use sudo apt get auto remove to remove any unwanted and any unneeded dependencies. 108 00:06:21,150 --> 00:06:24,810 And just because they were used for one package and you remove that package doesn't mean they're no 109 00:06:24,810 --> 00:06:25,980 longer needed for another. 110 00:06:25,980 --> 00:06:26,850 But don't worry about that. 111 00:06:26,850 --> 00:06:29,010 The package manager is going to take care of all that for you. 112 00:06:29,010 --> 00:06:29,480 Okay. 113 00:06:29,490 --> 00:06:33,720 And you also learn that when a software package is installed, it is first downloaded and saved on your 114 00:06:33,720 --> 00:06:35,580 system in a compressed archive. 115 00:06:35,610 --> 00:06:39,930 In this archive is saved on your system even if the package is installed, and that means it's taking 116 00:06:39,930 --> 00:06:40,500 up space. 117 00:06:40,500 --> 00:06:45,020 It's kind of like the wrapper or the packaging behind the actual thing that you want. 118 00:06:45,110 --> 00:06:49,050 Okay, so to clean up all the packaging and clean up all that stuff, what you've got to do is sudo 119 00:06:49,050 --> 00:06:54,420 apt get clean and that's going to delete all the compressed package archives and save you a heck of 120 00:06:54,420 --> 00:06:55,020 a lot of space. 121 00:06:55,020 --> 00:06:59,490 You'd be surprised sometimes even gigabytes at times, but perhaps you don't want to clean up all of 122 00:06:59,490 --> 00:07:00,840 those packages for some reason. 123 00:07:00,840 --> 00:07:04,990 And they said you just want to clean up the ones that can no longer be downloaded from the abundant 124 00:07:05,070 --> 00:07:05,640 repositories. 125 00:07:05,640 --> 00:07:08,460 So for that you'd use pseudo apt to get auto clean. 126 00:07:08,940 --> 00:07:10,050 So there you have it. 127 00:07:10,050 --> 00:07:10,740 You're beautiful people. 128 00:07:10,740 --> 00:07:15,990 You now know everything that you will ever need to know about package management in Ubuntu and you've 129 00:07:15,990 --> 00:07:20,940 done so unbelievably well that in the next video I would like to congratulate you and have a recap of 130 00:07:20,940 --> 00:07:21,660 what we've learned. 131 00:07:21,660 --> 00:07:25,920 So for some well-deserved praises and a recap, I'll see you in the next video.