Advanced Pacman Options: Learn The Arch Package Manager

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
if you've been using arch or any arch-based distro that makes use of pac-man for any reasonable length of time you probably at least have a basic understanding of how pac-man works so how to update packages how to install packages and how to remove packages but when it comes to doing some of those more advanced features or some of those features that you use far less often so things like listing out your orphaned packages or listing out the packages that are dependent on a package that you have installed for things like that it gets very easy to forget what the options you have to use for those actually are so today i thought i would do a video going over some of those things because i know that i tend to forget them pretty often so if i forget them pretty often i'm sure that someone else has the exact same problem so the first one we'll go over is listing out the package info so that'll be things like the name the package who the maintainer is what the dependencies are and things like this so the way you're going to do that is with pacman s i so i in this case as you can see down here is view the package information so s i and then pass in the name of the package you want to look at so let's look at say neovim and as we can see we can see which repository it's in we can see the name of the package we can see the version number a description the architecture and a couple other things in here as well so things like the dependencies and the optional dependencies as well now with si it's going to list out the package info for any package in the arch linux repository so even ones you don't have installed so if we just go pacman dash capital si again and do it for emacs i don't have emacs installed but it will still list out the info for that if instead you want to limit it to just listing out the info for a local package what you can do instead of si is do qi so q commands are going to be query commands on the local packages you have installed so if we just run that now as it says the package emacs was not found now when you install a package sometimes it's going to modify some of the config files within the etsy directory and in those cases it might actually create a backup of those files so if you want to list out the package info and the backups what you're going to do is pac-man q i i so let's say we're going to look at it for something like neovim and nirovim just has one backup file it's located in c x d g slash nvim sysinit.vim and let's say we want to look at something like bspwm just to show you that this doesn't come up for every single package so in this case as you can see this one has no backup files and modifying this command a bit it can also be used when you're trying to write an aur package so i was working on one for tiramisu and basically what you can do is you can run pacman-qip on the package that is generated when you try to run make package so i'll just show you what i mean we'll run make package here and i'll just show you uh just briefly as you can see in here i've got a package build file so this is just the repo for that aur package so what we're going to do is we're just going to run pacman qip on that package file that we just made so this tar ball right here so this is the newest one and we run that now and as we can see we can see the name of the package we can see the version number all the same stuff we saw before but this time it's not for a package that we actually have installed or for one that's in the standard repos it's just for a package file that we have access to so this is really useful for when you're trying to make an aur package and you just want to make sure that your package info is all correct before you actually go and push it remotely up to the aur so another thing you might want to do is list out the files that are contained within a package so if you want to do that on any package that's available within the standard repos what you can do is pac-man dash f l so fl is going to be querying the file database and what we're going to do is we're going to run this on let's say i don't know we're going to do neo vim again and this should show us every single file that when we install the neo vm package will be installed along with it so there is a ton of different files in here i'm not going to scroll through all of them because that would take way way too long and as i said this will work on any package so not just packages that you have installed so we could also do this on once again on emacs because i don't have that installed and this will list out every single file that when you install emacs will be installed along with it now if you just want to look at local files what you can do instead is do ql so let's just look at emacs and as we can see emacs doesn't come up but if we do it for neovim then this will show the information on near them or we can do it on something like bspwm and that will show all of the files installed with bspwm and this also does work on things that you did install from the aur as well so if we do it on what is something i have from the aur library app bin so as long as it's installed on your system even if it's from the aur as long as pacman has access to it you can do all of these q commands on it and once again like with qip we can do qlp so p in this case refers to package l refers to list files we can do that on a package file that we have as well so pacman dash qlp on the package file over here so this will just show us every single file that gets installed along with this package and we run that and unlike some of the other packages this one only has a couple so the next one we're going to look at is pac-man sg so what g stands for in this case is group so what this is going to do is let you list out the packages contained within a group so let's say we wanted to look at the packages contained within the plasma group so as we can see we have all these different ones in here so oxygen libka screen this if you don't know is the group for the plasma desktop so we can also look at say i don't know bass develop and see what comes with bass devil so bass dash devel and we run this and we see we have things like auto comp ben utils bison file gawk grep and a bunch of other tools as well so this is useful for finding out what packages are going to be installed if you try to install a group or if you're trying to get rid of a group what packages you need to get rid of and like with what i said earlier if you do it with q instead of g what it's going to do is list out the packages contained within a group that you have locally installed now this does work a little bit differently from the other ones we saw so i'll just show you what i mean if we run this now this will be the exact same result as when we ran it with s but let's run it on plasma and see what it's going to do so as you can see it still lists out some results because all of these packages here are contained within the plasma group however i don't have the entire plasma group installed so even though you don't have the entire group installed with the queue command you can still see what packages are contained within a group even if the rest of that group isn't there moving on if you want to see what packages you have installed explicitly as dependencies what you can do is pac-man q d so this will list out every single package that was installed as a dependency now instead if you want to list out the packages that you explicitly installed so the difference here is if we do qe these are the packages that i said i'm going to install on my system so i installed waker i installed w3m i installed x wallpaper whereas with the other one these are things that got downloaded alongside those packages so these are just installed as dependencies if you were to then go and manually install one of these files so let's say you wanted to install something like i don't know z lib then z lib would move from being installed dependency to an explicitly installed file so that's just how those two differ but generally you don't really need to know what packages are installed as dependencies or what you've explicitly installed something that might actually be useful though is combining qd with the t option so if we just have a look at that so pacman dash q and we have a look at what d does so d as we can see lists the packages that are installed as dependencies so we're going to do that one and we're also going to do the t option now what t does is list the packages not required by any package so what this is going to be is the packages that you have installed as dependencies where the things that their dependencies for aren't actually installed so what this is are your orphaned packages so we run this and as we can see i have a couple of them so we have things like clang dep ffmpeg thumbnailer mozilla common and a couple of other ones in here so if you're not actually using these packages for anything else on your system it'll be perfectly fine to uninstall these because they're not actually being used by anything now if you're actually using these on a day-to-day basis what you should do is get rid of it as an orphan package and reinstall it as an explicitly installed package just so if you ever want to get rid of your orphan packages it's not going to also delete something that you actually need for the next thing we're going to do we're going to first have to run pac-man dash fy or s-wise so pac-man dash fy or sy does the exact same thing now with sy one thing you have to keep in mind is never run sy and then say you try to install a package the reason why you don't want to do this is because of what wire does what y does will basically update your package database without actually downloading any package updates so the reason why this is a problem is because let's say you wanted to download the newest version of neovim and you try to download it with the y option as well now what this is going to do is update your databases so you might get a newer version of neovim then you actually have the dependencies installed for so if you want to install a package only ever do pacman dash s or pac-man s-y-u so the you option in this case is going to update your packages so if you're going to sync your database and you're going to update then it's fine to install a package if you're not going to sync your database and you're not going to update it's also fine to install a package but don't sync your database and then install something you might cause some problems by doing that but if we're just running pacman dash sy to update our databases it's going to be perfectly fine to run it like this so we're just going to run that give it a second to synchronize the databases and as we can see all of it is up to date now so what we're going to do is run a pacman dash f so what pacman dash f is going to let you do is search for a package that contains a file so let's say we wanted to find out what package contains something like emacs and as we can see that's contained within the extra slash emacs package and that'll be located in user slash bin slash emacs so we can tell that's a binary file and it's also contained within community emacs dash knox and that is also contained in user slash b and slash emacs so let's run it again for something like nvim and as we can see the binary for nvim is contained within the neovim package but if we were to search for something like neovim as we can see we're not actually going to get any result and that's because with just the dash f option it's not going to do a regex search if you want to do a regex search what you have to do is include the x option so in this case we'll find a couple of things that contain neovim now the reason why this is working but it didn't work before is because in the case with nvim right here nvim is the entire name for the file whereas in the case of neovim here neovim is only a partial name of it so what we could also do is we could do something like let's say we do dot star now what this should do theoretically is list out the same stuff so so another thing we can do is we can also do regex searches so we could do something like let's say v dot star or something like that and what this is going to do is list out everything that starts with v and then has any characters after so we run this now and as we can see this would go for quite a while because what it's basically doing is listing anything that contains a v and then literally anything after the v so basically anything that has a v in it this would do the exact same search as well but you can also do more complex regex searches like say you want to search for something like this for example what this is going to do is find anything that has a v in it has any other characters and then has an m at the end so we run this and give that a second to go and as we can see this has a v here then has an m here and then it has anything in between so it works like a normal regex search works i'm not sure what sort of regex it uses i'm going to assume it uses the same sort of style that grep uses but i'm not entirely sure and if you just want to do the regular f search but you want to do it on only locally installed packages what you can do is pac-man q o and then say let's look at something like nvim and as we can see nvim is owned by the neo-vim package or we could do something like bspwm that's trying to do it on my folder called bspwm okay my bad bspc let's do it like that so as you can see bspc is owned by bspwm another thing we can do with q is list out the count of the files that are installed by a package now obviously you can go and manually count them yourself but the nice thing about this is also count the files that aren't installed so for example let's go pac-man qk and look at bspwm and as you can see we have 50 total files installed and zero missing files now the zero missing files is the important part so let's say you're messing around with something in your root directory and you accidentally delete something that might be needed by a package well if this says zero missing files you didn't delete anything too important but if there are any missing files that means that for some reason or somehow some of those files got deleted and to fix that all you'd have to do is just reinstall the package it's not really that big of a deal as long as you don't break something like pac-man you're probably going to be fine so when you're installing upgrading or deleting packages with pac-man what it's going to do is maintain a package cache and the package cache is going to make it so you can very quickly downgrade a package or reinstall packages that you recently uninstalled but sometimes you might need to actually clear out that package cache whether it's because there's a problem with it or you just need to free up some disk space and the safest way to do this is to just clear out the package cache for things that you don't have installed anymore and for that all you have to do is run sudo pacman sc now you can also run this with an extra c and what this is going to do is clear out the entire package cache but this isn't really recommended just in case you need to reinstall any packages or you need to downgrade if you do clear out the cache it's going to take a little bit longer to do so but it's not like you can't go and downgrade a package by just re-downloading it so it's not like it's too big of a deal so if you desperately need that disk space then you can do this but otherwise you should probably avoid doing so now the next thing i want to talk about is just some of the basic uses of pacman just so i can cap off the video now i went and installed emacs off camera just so i can go and uninstall it because the first thing we're going to be talking about is uninstalling a package so sudo pacman dash r now generally i would really recommend against doing a just dash r because what dash r is going to do is get you those orphan packages so dash r will just uninstall the package but not touch any of the dependencies so you can uninstall a package like this but all it's going to do is uninstall the package now what i would recommend doing at a bare minimum is running dash r with the s option so what this is going to do is remove the package and also remove its dependencies but i typically go a bit further than this as well so what i will do is i will at least run pacman rs and also the c options so what this is going to do is remove the package so that is the dash r option remove the packages dependencies so that is the s option and then remove everything that is dependent on the package so that is the c option so we run this and it should be basically the same result because i don't have anything dependent on emacs but the problem with this one is it is recursive so you can end up removing far more things than you really want to be removing so just pay attention to what it's trying to remove now if it's for something like a text editor generally you're not going to have anything that's dependent on it but if it's for something a bit more low level like i don't know some sort of library you need make sure that you're not going to nuke your entire system by deleting it so just look at what is being uninstalled and sometimes it's going to be better to just avoid the c option and just do dash rs but if you want to go and uninstall packages the same way that i do i do one extra option with this so i do the end option as well so normally i'll write it out as rcns just because that seems to flow off the tongue pretty well so what this is gonna do is all of the stuff i said earlier but also remove any config files that were installed in places like the etsy directory and places like that along with the package now it won't go and uninstall things that running the program generates itself so it won't uninstall things that are in your config directory but if when you install the package it also installs some sort of config file within your etsy directory this will clear those out as well just so you don't have a bunch of files that you don't really need on your system this is how i'll normally go and do it so let's just run this now get rid of emacs and there we go the last thing i wanted to talk about was syu what this does is the y option that will synchronize your package database and then the you option will download the updates now the reason why i want to talk about this is because i'll occasionally see people coming from other distros like say ubuntu who don't really understand what the why and the you options are actually doing and think it's just some magical thing that will update your packages without really thinking about what the options actually do so y will synchronize the package database and you will download the updates now you can also run this with an extra option you can run this with the w option and what this is going to do is download all the package updates but not actually install them so if you run that now what it's going to do is synchronize the package database download the updates and not install the updates so the reason why you'd want to do something like this is let's say you have a really low data cap at home and you want to download all your package updates at like university or school or whatever so what you can do is download it with the syuw option and then when you have time to update go and update then the other use for this is let's say you want to download all your package updates with a cron job because you don't want to wait for your updates to actually happen and that's what i actually do and as you can see i just have one cron job in here so i run pac-man s-y-w and the dash dash no confirm options so dash dash no confirm basically means it's not going to prompt you to say yes or no to anything it's just going to go ahead and do it this option i wouldn't recommend using most of the time it's only here so you can run pacman from a script without having to interact with it but as you can see what i'm doing is twice a day five minutes past the hour i'm downloading all of my package updates pretty much because i don't feel like waiting for my packages to download i'd rather just have them all get downloaded and then when i want to update i'll go and update so i think that's pretty much everything i want to talk about today now obviously as i said this isn't every single thing that pac-man can do if you want to go see a full list of what pac-man can do check out the man page for pac-man that's obviously a good place to start but another place you can go to is the pacman page on the arts linux wiki which we link down below and this is where i found some of these commands that i don't use too often so things like the orphan packages that's not something i really use too often myself things like the package info and things like that i actually do use this especially for making that aur package but there are other ones on the arch linux wiki as well that i didn't talk about today so feel free to go check those out and maybe you'll find out something else that's pretty useful so i think that's pretty much everything for today's video but before i go i want to thank my patrons so a special thank you to joachim nathan andrew montez rprd road tony donald you larry and silva if you want to join the patreon there'll be a link to that down below as well as my amazon affiliate links we can buy the gyros in this channel or anything else you want and i'll get a small kickback for it also i'm going to go check out my podcast that is tech of a t available on library and youtube and the audio version available wherever you listen to audio podcasts also remember to check out this channel available on library bit tube and also bit shoot and remember to smash the like button and leave me a comment down below and remember to subscribe ding the bell down below as well so i think that's everything for me and i'm out you
Info
Channel: Brodie Robertson
Views: 2,754
Rating: undefined out of 5
Keywords: brodie robertson, pacman, arch pacman, arch pacman tutorial, arch package manager, arch linux pacman, arch linux pacman guide, arch linux package manager, arch pacman options, arch linux packages, arch linux package install, arch orphan package, package manager, package manager linux, linux tutorial, arch linux tutorial, arch linux guide, linux guide, arch linux, pacman package manager, pacman package manager tutorial, arch linux package
Id: obV2epvQREM
Channel Id: undefined
Length: 19min 38sec (1178 seconds)
Published: Sat Jul 04 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.