Episode: 3357 Title: HPR3357: My terminal journey, part 02. Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr3357/hpr3357.mp3 Transcribed: 2025-10-24 21:35:06 --- This is Hacker Public Radio Episode 3357 Fortuzzi, the 15th of June 2021. Tid's show is entitled, My Terminal Journey, Part 02, and is part of the series' apps' feel-on-king it is hosted by some by on the internet and is about 32 minutes long and carries a clean flag. The summary is becoming terminal-friendly. This episode of HPR is brought to you by archive.org. Support universal access to all knowledge by heading over to archive.org forward slash donate. Hello ladies and gentlemen and welcome to another episode of Hacker Public Radio. I'm your host, some guy on the internet and today we're going to have another episode apart two of my terminal journey and this is you know the becoming friendly with the terminal is the sub title here. It's part of the app's feel-on-king series because I didn't know what else to uh to select as and I was tired to just constantly selecting general for everything but I mean you know it general works right. Alrighty so I've got a new format I'm eager to test it out let's get right into it. All right first thing first we're going to be discovering our packages meaning our packages that need to be updated and upgraded on our system and we're going to be using the vertical list this time using the apt package manager that's just the APT package manager. Now let me just go ahead and move right on over to so APT that is the alpha of papa tango apt package manager we want to do a command of pseudo apt list so that pseudo space apt space list space and then we're going to do hyphen hyphen upgradable. All right let's start off with pseudo pseudo is your root privileges if you're used to windows windows you would have the uh add administrative privileges or whatever or run as administrative whenever you were right click on a file and then run it you would get the option to run as administrator uh well in Linux using the terminal pseudo is that exact same thing it's root in Linux so you're getting root privileges for a single command now the apt APT is the command name apt is the package manager under Ubuntu and Ubuntu based systems um there are others that you can use as well you know there's apt is apt get aptitude it but we're going to talk about apt for now uh what we're going to add on to that as well as the list you want to get a list of the packages but not just any list of packages you want only the ones that are upgradeable and that's why we use the dash dash upgradeable just to kind of narrow things in and that'll just give us the list of packages that have an available upgrade all right so I'm going to make sure that I give you that command standard output down in the show notes and I'll shorten it up I'll get a little bit from the top a little bit from the middle and a little bit from the bottom of the output and just paste it in there so that way you can get a feel of how the layout of it will come obviously depending on how often you update upgrade your your system yeah you you might have a lot more if you don't do it very often or if you like me you update regularly it won't be that much but again I only put a few of them here just because this is just to give you a feel of what you should see if you run that command all righty next up let's talk about apt get now the reason we're going to use apt get instead of apt this time is because apt has the list function that you can use to get the list of upgradeable packages that's nice that's great if you want to use apt but another way that you can do it and get a different layout of the packages you know like a different format for how the information is displayed for you with a little extra information as well as we can use apt get which is virtually the same thing is just I think apt was created by Ubuntu and apt get was created by devian but I think I'm fairly on par here we go so the first thing we're going to do here's the command pseudo apt get now that's that's apt hyphen get they were going to do a space they were going to use the hyphen u option following that we're going to do a space upgrade space assume no well it'll be space dash dash assume no to the very end of the command let's go ahead and go through a breakdown of that command so you guys remember the pseudo part right that's just root privileges aka admin privileges for a single command then we move into apt get which is the command name and it's the command name of the package manager which is known as apt get now we're going to go to that u option there or u flag however you want to call it it also has the long form which is dash dash show upgraded right and all that does is list the upgradable packages now the thing about this one is it has to be used with the upgrade command you can't just run apt get and then do the u option and get the upgraded packages you have to run and upgrade as well to then get the list of upgraded packages so obviously we're going to run the upgrade command right after the attack you or or dash you excuse me now we don't actually want to upgrade we just want to see the packages so what we do is at the very end of that we're going to use assume no and all that does is just says you know at the end of the command when you're installing software or updating or whatever it says you know do you want to continue or do you want to make these changes to the system you're automatically going to be answering no to that because you don't want to make any changes you just want to see it first right so that's what we're doing no commitment here no right off the jump but just give me the the information I want that's the design of this command so now right after that oh you know what I should probably tell you this as well the command in Linux meant the the option for dash u or the show upgrade that's not actually in the man page for apt get I had to go online to view that because the man page for Linux meant I mean the man page for apt get under Linux meant it'll show you at the very top in the synopsis that you is an option that can be ran but down in the description we try to get more details on it it's not available down in there so I don't know if that's a bug or what and I don't even know how to I don't know who to even tell that that's a bug I don't know if you tell Linux meant that or you know it's so I'm still trying to figure that out but I'll eventually just post it in a couple of places and see what information I get back okay so the command standard output should give us a nice long list not really long but it depends again on how long it's been since the last time you've done an update upgrade this command will give you the packages in a horizontal layout though so it'll be just one package after another going from left to right as well as some other useful information like it'll also tell you things like let me just take a quick look here following packages were automatically installed and no longer are required so you'll get the auto remove thing if you wanted to do pseudo app auto removed it shows you what packages will be removed if you do that now in my case I have an Nvidia GPU in here and it's showing a bunch of Nvidia stuff in here to auto remove I'm not going to auto remove that because that sounds like a bad idea like I may have a serious situation if I do that plus I haven't investigated what those different things are I know that they have to do with the GPU but I still don't know exactly why it's telling me to remove them so I can investigate them and I know about them now but I'm not going to run that command which is the auto remove command no sir I see which packages have been kept back which is great it's got some images in there that it's keeping back okay I see that and it lets me know in total that I have 60 packages that could use an upgrade and five of them will not be upgrade in total that'll be 295 now after this operation that you know how much this space will be used and it automatically says no to do you want to continue because we put the assume no in there so it's a nice breakdown of everything and it just it just allows you to see more of what your system is doing when you updating upgrade right and you get a list of those packages like you know what what exactly is my system installing you see it you can now from the last episode you know how to use the app cache so you can search now and discover what your repository has as far as information on the packages and the reason I'm showing you all of this is when you're learning Linux and you see a lot of people doing things like you'll start off with a lot of graphical interfaces like you in Linux Mint we have a store just like other distributions and that's a gooey way of viewing things but you'll see a lot of tutorials people do a lot of things through the command line and it does look much faster you get just the basic information without all the graphical nonsense which is fine if that's what you want to use but sometimes I just want the information and this way gives it to me faster and in the format I'm comfortable with now and I'm showing you how to do the exact same thing you don't have to pull up a web browser you know how to use app cache with the search option there and start searching through your the distributions cache of packages to identify each and every single one of these packages and that'll get you going so I'll try to link to the last episode where part one of the becoming terminal friendly so that way you can see that or listen to that because it's a podcast sorry about that well I mean technically that there are show notes too so you can see and listen to it I'm hoping this is a great new user learning tool but enough distractions let's keep powering right through this we're going to move right on into our third command of the day we're going to talk about this one is not app related by the way this is now we're going into the devian packaging tool this this comes with a lot of Ubuntu basic distributions again I'm on Linux Mint 20 so this is called the dpkg tool and we're going to be using it as dpkg hyphen query and we're going to use the dash l option when using that command let's go ahead and do a breakdown so the command name will be called dpkg-query now I don't think you need to use the dash query here I like to use it that way because that's the way it was listed in the man page but and I'll talk to you more about the man pages a little bit later on some cool tricks you can do with that as well to keep you from always having to pop into a terminal read the man page you can kind of do it through a text follow whatever as well and make it a little bit easier to search through as well because you can use grip to search through it a lot faster that way but I'll talk to you about that later on all right so you know what the query is that's the name of it you're just going to be searching but what we're going to be querying is a list of all the installed packages so that's why you use the dash l or if you want to do long format like if you're doing the script with this in there which I don't know why you yeah if you were interested in doing a long format it will be dash dash list so it'd be dpkg hyphen query space dash dash list so that's the long way of doing it the short way is just dash l as an option to listen install packages so that'll just give you a massive list depending on how many packages you have on your system it is going to be a big boy list and I will have an abridged version of that list here I'm only going to show a couple of packages because again I think it was like two thousand something packages or something so there's no need to put all that up on here you just need to see what it looks like so that way you can get familiar with what you're going to see and you'll have an option as to how do you want to view this information and that's important because your workflow how how do you feel comfortable with it now another thing you could do using dpkg query instead of using the lowercase l you know the first when we did dpkg query space hyphen lowercase l that was the first third command excuse me for the fourth command here we're going to be a little bit more specific and we're going to use dpkg hyphen query space hyphen capital L now and after we get that capital L we put another space and then we actually give a command name and the example that I'm going to use here one of the commands that we got like the very first command in there or something like that was the ad app command or a package I should say it's also the command but it is the package excuse me mouth is probably need to drink some water here okay I'm back I had a little bit of water where did we left off capital L using the dpkg query with the capital L or the long form of it instead of typing capital L you can spell it out with dash dash list files now you give a specific file that you want to list in this case we're going to be using the ad hyphen apt hyphen key that's the name of the file we're going to be using because that's the one that's installed on our system that was revealed when we use the the third command which was the dpkg hyphen query space hyphen lowercase l that gave us that massive string of packages installed and we just pick one of the ones at the top to do a specific search on now this specific search using the capital L on the ad app key package would reveal just a vertical sort of directory style layout of the package and you know location so it'll give you like to read me the authors all the other stuff that's in there so if you if you search like them or any other thing that you have installed you can find out where it is first of all which is great and this also depends on how it's installed so this is dpkg so if it was installed via a deb package using the app package manager that's great but if you did something like use a snap then this this is not going to cover that so that's why you run that first I mean in order of commands that we've already ran through you would run that third command which was the dpkg query lowercase l to first see what commands are available to test the specific thing on that they were doing now the uppercase or or capital L that we're currently talking about and yeah I got a couple examples of what those command outputs would be down in the show notes down in there so you can just scroll right down there see the dpkg query the two versions that we're talking about which is the third command and the fourth command and see what the outputs will look like and again those outputs or at least the one for the lowercase l dpkg query lowercase l that would be a bridge because it's massive I'm not going to show that whole thing all right so for our fifth and sixth command we're going to be talking about apt mark that's the name of another portion of apt and apt mark basically just allows you to mark and hold a package that way the package you know it won't be allowed to be upgraded if you don't want it upgraded an example of that I can give you let's say cadence live right back in the day or not back in the day but you know about a year ago whatever when I started using well I guess it was more in a year ago because I started in 2019 using Linux but when I started using cadence live either way no matter when it was I forgot where version it was but I do remember it they had an update and that update caused a lot of crashes and I was trying to figure out a way to keep that damn thing from updating turns out this method would not have helped me using the apt mark for that particular package because of the way I installed it I used flat pack to install it so I don't believe that apt mark would have saved me in that particular case but I'm just using it as an example so that you could understand why you would want to keep a program from updating or upgrading because when you're trying to get your work done editing video files and all of that and everything was great just yesterday and then now today this damn things crashing non-stopping you don't know what to do oh it was frustrating I eventually found out that they had that they had what they call app images and the app images I could just stay on the same version and not upgrade you know that would have been so sweet if I had I was new at the time so I didn't really know I had to do a bunch of googling to try to figure out what the hell could I possibly do found some answers on reddit things worked out ultimately but if you have a package installed via apt you know using apt git or apt or aptitude whatever you can then hold that package in its current position so that it will not be updated or upgraded by using the apt hyphen mark command now I got a command example down in here and we're going to I'm going to spell it out for you and then we are go through a breakdown pseudo space apt hyphen mark space hold space in the package that we're going to hold for an example here is google hyphen chrome hyphen stable that's the command that we're going to be using now let's go ahead and throw a semicolon in here which is going to serve as you know an end of that command and then we're going to talk about how to reveal that this package was actually held that is the pseudo apt hyphen mark show hold all right so you guys know about the pseudo root privileges apt mark commanding hold is what we want to do using apt mark so we want to prevent the package from being updated or upgraded whatever using hold in that particular package that we're affecting using hold would be google chrome stable we're going to end that command using the semicolon using that that's going to be our separator as well so when we run the second command immediately after the first one we do a space after the semicolon and begin our second command which is pseudo apt mark show hold to reveal the packages that are being affected by hold nice and easy isn't it now the breakdown I'll put out there and show no to look a little bit better than how I'm explaining it to you but I hope that it made sense now because that was an example and I really don't want to hold google chrome I just wanted to show you you that you could hold a package from upgrading just to keep it at a certain version until you're ready to upgrade it so say for instance the upgrade 6.1 was buggy so you're waiting for like 6.2 or 3d come out and then you'll upgrade to that to avoid the buggyness of 6.1 that's you know a nice cleaner example we want to un hold now so that way we can get that clean stable upgrade so what we're going to run here the command is pseudo apt mark un hold google chrome stable right that's that's the layout there and we're going to do a quick little breakdown pseudo root privileges apt mark is the command name un hold is what we want to do using apt mark and then google chrome stable is the package that was once affected by hold but will no longer be affected by hold because we're now invoking un hold all right now once we run that command once you hit enter and run that if you were to then do another show hold to reveal what packages being held you should get nothing back because you know that was the only package that you had affected by hold and now that you've removed it using un hold yeah you get zero all righty last but not least our bonus command of the evening today I want to share with you how I export my man pages and I do this because I want to view my man pages in VS code and I can actually like if I'm in the terminal also on VS code you know I told you that it has a built-in terminal I think it's controlled till there or something like that that'll pull up the terminal in VS code but that's the way I do a lot of things in terminal now and I just open up VS code because I got both the note pad and the terminal on one application screen super nice but I like to export my man pages especially the ones that I use a lot especially when I was building out the show notes and everything for this I needed to go back and forth back and forth and copying and pasting from the terminal is a little bit awkward from time to time just because you forget the hold shift when you're doing it so like if you copy it on the text pad you would just do control C and then you go to another thing and then you do control V to paste well when you copying from the terminal you have to do control shift C if not it'll just do control C which will cancel the command and you know and it got a little awkward so it's like if I just export these to a text file I won't have that problem anymore and now we're about to learn how I do that it's a massive command well not massive I shouldn't exaggerate but it's it's it's pretty big so I'm not going to go through the entire thing it'll be there so you can see it and I'm going to I'm going to walk you through most of it and leave the rest for you to kind of figure out on your own so it's like a little exercise built in but not too difficult again I'm thinking new users are going to benefit from this the most and this this should help so in that command down there the bonus command section down there where you'll see exporting man pages the first of all I started off with touch you can use touch to create files you can also use it to update so you can check the man page for a touch by typing in man space touch and then you can see what touch is capable of doing but we use touch to create the apt get text file that's the first section of it we use a semicolon to separate that command and begin the next one which is running a date to command now right after the date command we use the greater than and then we want to send because that greater than allows us to send our standard output into a different direction rather than showing it on the screen because we don't want to see it on the screen we know what it'll reveal but we want to put it into that command we we're about to create so to command the the file we're about to create is called apt get zero one dot txt we're going to send date the output of running the date command directly into that file and the reason we're doing that just so we can whenever we open the file we don't know the date that we created it the date and time then we're going to run the third part is an echo command we use the echo command with the hyphen e flag or option that will allow us to insert a new line you'll see in double quotes there I'll have a backslash in that's how you do new line with echo so basically it's just like when you're in the text document and you press enter and you get to the next line now if you were to do that and you didn't type anything it would just be a blank line right nothing to be there but you still would create a new line just by pressing the enter key or depending on your keyboard I think it might be labeled return key whatever but that's what that backslash in it does and the only way that'll work is if you have the hyphen e option if you don't have the hyphen e option then that backslash in will not create a new line and then what we want to do is use double greater than symbols there to redirect what that means is the first one redirects the output the second one signals to append that redirected output to the selected file so we don't want to wipe the file and replace it with a new space we just want to add the new space behind the last thing that we sent to the file which was the date command remember we sent the output of the date command now we're appending to that using a new line using echo so I'm just putting a space in the file basically it's a little weird how you do it but it works trust me and you can test it out I made this a little bit cleaner rather than my own personal directories I figured everybody's got just a regular documents directory so it'd be easier for you to just test this command out on your own all right so the fourth section of this command would be apt-get version right because we want to know the version of apt-get that we have on our system and we want that placed in the command after that new line we just created so we're throwing our version of apt-get into the file the fifth section here is going to be an echo now just like the first echo we use to create a new line this time you'll see backslash in backslash in apt-get right so there's two blank spaces after the version that we just put into the file now say that again two blank spaces followed by apt-get space hyphen hyphen help because that's the command that we're about to send into the file and then after you see the word help what do you see two more blank spaces or not spaces new lines excuse me I keep saying spaces but new lines that's what the backslash in stands for so you get two new lines apt-get dash dash help and then two more new lines in other words we are creating a label so when we're viewing the file you can see that there's going to be a gap in between the version information and then you'll get the label and then there's going to be another gap following the label and what are we going to put following the label well the actual command which is apt-get space hyphen hyphen help which is the help page for apt-get right so we want that in the command before we add anything else now we go ahead and put you know we do the double greater than remember where we're pending so double greater than add that apt-get help right beneath the label into the command I mean into the file now there's three more portions of this they are intentionally left the blank you should be able to look at them and tell exactly what they're doing from the breakdown that I've given if not I mean just test it play with it it's nothing harmful I'm sure if it was something harmful the community appointed out we got a great community I promise you it's not harmful at all if anything you'll just be confusing to your manipulated a little bit and then you'll see oh yeah he's right you know you're just adding labels into a file because you can just open up the file in VS Codeium or if you're using Z or whatever your text you know them whatever you're using and yeah you know just play with it see what what you're capable of doing and this is basically how I learned you know found some commands read about them in the man pages maybe even search them online if I couldn't find information a way that I needed to absorb it from the man pages and then you know just kept searching and playing and towing with all of this stuff and there you go so now you're probably 1% less new which means you're still right beside me in this race and I hope this was beneficial to you that's all I've got time for today and until the next episode I'll see you guys later you've been listening to Hacker Public Radio at Hacker Public Radio. We are a community podcast network that releases shows every weekday Monday through Friday today's show like all our shows was contributed by an HBR listener like yourself if you ever thought of recording a podcast then click on our contributing to find out how easy it really is. Hacker Public Radio was found by the digital dog pound and the infonomicon computer club and it's part of the binary revolution at binwreff.com if you have comments on today's show please email the host directly leave a comment on the website or record a follow-up episode yourself unless otherwise status today's show is released on the creative comments attribution share a light 3.0 license