Let’s Play Around With ‘apt-cache’

Today, we’re going to learn about apt-cache. Obviously, this information is only useful for distros that use the apt package manager. You’ll find that apt, and apt-cache, are package management tools – useful for managing (installing, removing, and updating) the software on your computer.

To know about apt-cache, we should probably know about apt. I think the man page describes apt well enough with this:

apt provides a high-level commandline interface for the package management system.

And apt-cache defines itself as:

apt-cache – query the APT cache

While it further describes it as:

apt-cache performs a variety of operations on APT’s package cache.

As you can see, they’re necessary and valuable tools for the management of software on your Linux box. Not all distros use apt, but it’s generally used by the distros in the Debian family. Those are distros like Ubuntu, the official Ubuntu flavors like Lubuntu, Kubuntu, and Ubuntu Mate, as well as distros like Linux Mint. 

So, it’s used by quite a few distros and, importantly, many of those distros are the favorites for people who use Linux on the desktop. I’ll also note that apt works equally fine in a server environment, without a desktop. It’s widely used, widely supported, and easy to find assistance when you have questions.

Today, we’ll just be covering ‘apt-cache’ and some of the basic usage. It’s not a very deep article, nor does it need to be. While there are a ton of apt-cache options, chances are that you’ll only need to use a few of them. So, this shouldn’t take too long out of your day, or will make a good resource when you need to remember something.

Using apt-cache:

This article requires an open terminal. Just press CTRL + ALT + T and your default terminal should open.

For this article, our example will be inxi. We’ll assume you’ve already installed it, or are already familiar with it. If you don’t have it installed, now would be a good time to do so – as it’s a very handy tool. Where you see ‘inxi’ you can use any other package name you want. 

An easy command, if you want to display a bunch of generic information about a package, is the following:

That will show you a bunch of information about a package, installed or not. It requires the complete package name. In the next command, that’s not really required.

With the search flag, you could type in ‘inx’ and it will find inxi, among other things. You can use that command with the ‘–full’ switch, and get a ton of useful information:

You don’t even have to use an application name with the search – you can search for keywords and find applications that way! If you wanted a text editor, you can use:

You might be surprised at the number of results you’ll get with that command. There’s probably some text editors you’ve never heard of before, and they’re right there among those results! Installing them is just a command away!

We can also check the policy, showing things such as which version is installed, which version is available, and the repository name. It’s just as easy as the rest.

The output of that command is pretty handy. It’s a short output that tells you which version you have and which version you have installed. It’ll also tell you which repositories hold the software, often more than one, and what the priorities are for those repos.

Bonus apt-cache Features:

Among these great features, you can easily see both the dependencies and the reverse dependencies. Dependencies are the extra software that needs to be installed for the package in question to function and reverse dependencies are those packages that require the installation of the named package to be fully functional.

To find the dependencies:

The reverse dependencies:

There you have it! Those are the most common ways you’re going to use apt-cache. If you want to know more, you can always check the man page with man apt-cache. Dependencies, both regular and reverse, are probably worthy of their own article at some point. Normally, your package manager will deal with those, but you sometimes come across situations where you need to resolve dependencies on your own.

Closure:

And, there’s one bonus round! There’s pretty much no good reason to run this, other than curiosity, but you can actually get some pretty cool stats about how many packages are available, how many are real packages, how many are virtual packages, and things like that. It’s a pretty simple command with a lot of output.

See? Another lovely way to use the terminal to gather information. Personally, I do pretty much all my software management in the terminal. I just find it easier, more informative, and faster. I’ve done it for so long that it’s legitimately faster for me to use the terminal than it is for me to do so in the GUI.

Anyhow, thanks for reading. This is yet another article in a growing list of articles! We’re well past the halfway point in the year-long project and so far we’ve yet to miss a single publication date!

It’s going to feel good to finally say that my obligations are over – and then to probably keep writing just to keep getting more and more of this stuff online on my own site. ‘Cause that’s the kind of thing I do… In theory, I’m retired. However, I keep obligating myself to do more and more things. Ah well… This site is at least productive and, judging by the numbers, beneficial to the community.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Let’s Decompress A File (tar.gz) In The Terminal

Pretty much every Linux user has to look up how to decompress a file in the terminal. Ask them to do it by rote and they’ll balk, but it’s actually pretty easy. Heck, there are entire jokes and comic strips dedicated to it. The thing is, it’s actually pretty easy and this article is going to show you how.

The tool we’ll be using for this is called ‘tar’ and the man page helpfully describes it like this:

tar – an archiving utility

If one is curious, the .gz is for gzip. It’s both a file format and a compression utility. The .tar is a container for multiple files. Its name comes from tape archive, where one would store multiple compressed files in one file. Think of it as a container for .gz files, if that helps.

Today’s article is meant to be REALLY basic, so we’re only going to approach this with the tar command. The only goal of this article is to teach you how to decompress a .tar.gz from the terminal. (There are a dozen GUI ways to do this, but not all systems have a GUI available.)

Decompress A File:

This article requires an open terminal. You can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

You’ll also need a .tar.gz, but I’m going to assume you already have. If you don’t have one, you’re bound to reach that eventuality so long as you continue to use Linux. It’s a preferred file distribution format for things like source code. 

Anyhow, it’s really simple. Navigate to the folder where your .tar.gz file exists and run the following command:

You really only need to remember the vzf. In order, those stand for verbose (tells you what’s going on), z (decompress the files inside), and f (means the name of the file you’re working on).

The x flag means extract and we’ll get back to that in a moment.

You can even tell tar to extract the files in a specific directory. That’d look like this:

But, that’s not too terribly important, so long as you clean up after yourself and don’t leave a bunch of clutter. 

Let’s get back to that x flag. See, if you want to go the other way, that is to compress some files, you just change the x to a c.

In this case, we’re only to cover compressing all the files in a specific folder. That’s a little something like this:

So, really, you only need to remember the “vzf” and x for extract or c for compress. That’s the basics of decompressing a file in the terminal. There are a zillion possible combinations and the man page for tar is about a mile long.

In the vast majority of cases, those are the only two ways you’re going to use the command. If you need something more specific, check man tar.

Closure:

And, there you have it. You have the very basics on how to decompress a file from the terminal. There’s a lot more to the tarball but we really don’t need to cover that. If you need more, there’s the manual – but you probably won’t need more than that.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Upgrade Ubuntu From The Terminal

Today’s article will show how to update and upgrade Ubuntu from the terminal. Of course, this will work on any system that uses apt, including Debian, Lubuntu, Linux Mint, etc… You can always upgrade when the GUI tells you to, but you can do it manually on your own time.

Once in a while, I come across someone who refuses to upgrade. This is a bad idea. Upgrades include things like security upgrades and they’re pretty much mandatory. It’s Linux, so you don’t “have to”, but it makes you a bad netizen because those security upgrades may very well mean your computer is being used as a spam relay or, worse, a part of a botnet.

So, please, upgrade your Ubuntu systems – and, really, all Linux boxes should get regular upgrades. I can’t emphasize this enough! Upgrade your system – if not for you then for the rest of us who have to deal with enough internet hostility. Malware exists for Linux, as does exploits for Linux and the software you have installed. Even if you don’t care about your own experiences, care about the rest of the people on the ‘net. Thanks!

For this article, we’ll be using apt. Apt is apt-get in disguise, but not quite the same. If you’re scripting you use apt-get, because it’s more stable. When you’re running commands yourself, use apt because it’s faster/easier. 

This article should be pretty quick and easy.

Upgrade Ubuntu From The Terminal:

Obviously, this article requires an open terminal. You can open one with your keyboard – just press CTRL + ALT + T and your default terminal should open.

Once you have your terminal open, we’ll go ahead and update the database (the cache) to see if any upgrades are available. To do that, you run:

It’ll tell you if upgrades are available and give you some more information – such as telling you how to see which application upgrades are available. In this case, we’re just going to upgrade everything. Like so:

That is sometimes interactive. It will want you to agree manually to the upgrades. You can just skip all that by adding a -y flag. Even better, you can now string both commands together and save some time monitoring the terminal. That command, and I use this pretty much exclusively by way of alias, is:

The && means that the next command will only run if the first has been completed successfully. You can even add autoremove to this string of commands and keep things a little cleaner automatically.

The autoremove will “remove packages that were automatically
installed to satisfy dependencies for other packages and are now no
longer needed as dependencies changed or the package(s) needing
them were removed in the meantime.” You might as well include it, as it’s pretty harmless and will save you some disk space.

Finally, there’s full-upgrade which is quite similar to the old apt-get dist-upgrade, in that it will upgrade you to a new release if both a new release is available and your settings are to upgrade to new releases (instead of staying on a LTS branch, for example). You’ll find that full-upgrade is also capable of deleting unneeded files all on its own.

To use full-upgrade, you’d still run the update first and then run the command. You can also pack them together, like so:

And there you have it. That’s about all you really need to know about upgrading Ubuntu from the terminal. It’s not hard, so just do it. Yeah, once in a blue moon it breaks something. That’s usually easily fixed and the risk is worth the benefits – to you and the rest of the internet.

Closure:

I can’t emphasize it enough – do your upgrades regularly. Now you know how to upgrade Ubuntu from the terminal, which is something I naturally do out of habit. I actually have it aliased to the ‘update’ command and it takes care of all that for me. I can’t remember the last time it broke anything – but it has to have been multiple years ago. Breakage isn’t a real risk, as things are usually heavily tested.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

History: How Linux Got The Name “Linux”

If you’ve ever wondered how Linux got the name Linux, then wonder no longer, as this article will tell you about Linux’s naming history. It’ll be a relatively quick and easy article, which is perfect for today.

Assuming I scheduled this properly, this article will be published on America’s holiday, “Thanksgiving.” I suppose that means two things – thanks and giving. So, I’m thankful for Linux and I’m giving you this article explaining how Linux got its name.

This article was almost all copied directly from Wikipedia. That’ll save some time and effort! And, really, they detail it better than I could.

How Linux Got The Name Linux:

Quoting straight from Wikipedia:

Linus Torvalds had wanted to call his invention “Freax”, a portmanteau of “free”, “freak”, and “x” (as an allusion to Unix). During the start of his work on the system, some of the project’s makefiles included the name “Freax” for about half a year. Torvalds had already considered the name “Linux”, but initially dismissed it as too egotistical.

In order to facilitate development, the files were uploaded to the FTP server (ftp.funet.fi) of FUNET in September 1991. Ari Lemmke, Torvalds’ coworker at the Helsinki University of Technology (HUT), who was one of the volunteer administrators for the FTP server at the time, did not think that “Freax” was a good name, so he named the project “Linux” on the server without consulting Torvalds.[52] Later, however, Torvalds consented to “Linux”.

According to a newsgroup post by Torvalds,[9] the word “Linux” should be pronounced (/ˈlɪnʊks/ (About this soundlisten) LIN-uuks) with a short ‘i’ as in ‘print’ and ‘u’ as in ‘put’. To further demonstrate how the word “Linux” should be pronounced, he included an audio guide (About this soundlisten (help·info)) with the kernel source code.[53] Contradictory, in this recording, he pronounces ‘Linux’ (/ˈlinʊks/ (About this soundlisten) LEEN-uuks with a short but close unrounded front vowel.

And there you have it. That’s how Linux got the name Linux – and how to pronounce it, in case you didn’t already know.

And, wow am I grateful for Linux. Linux has brought me so many things and has opened so many doors. So, I’m gonna take a minute to also thank those who have helped get me here. Thank you. You know who you are. Thanks!

Closure:

Yup… This isn’t much of an article, but it is an article! I deserve an easy day or two. It’s the holidays and I’ve been particularly well behaved this year. Also, I’ve been exceptionally busy this year. Don’t worry, there won’t be too many articles like this.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Use A GUI To Manage Debian’s Software Repositories

You can manage Debian’s software repositories through the terminal, even by just editing some files. It’s not terribly hard, but there’s an “easier” way, and that’s to do so graphically. It may require some prep work, but it’s remarkably easy after you’ve taken care of that.

People sometimes ask if we prefer the GUI or a terminal, and that’s a complex answer. This is one of those times when it’s split up the middle, at least for me. For example, it’s absurdly easy to add repositories in the terminal, but it’s slightly more complex if you want to then remove those repositories. You need to remember things like the repo’s name – when you can just look in a GUI application and quickly see which repositories you want to remove.

If you’re new to Linux, Debian is a Linux-based operating system that is quite popular to build off. There are tons of derivatives, and even some derivatives of derivatives. Debian was released in 1993 and is the parent of popular distros like Ubuntu, and the grandparent of the many distros based on Ubuntu.

You know, I suspect more people use Debian derivatives than directly use Debian itself.

GUI Manage Debian’s Software Repositories:

I’m going to assume two things:

  1. You have a brand new copy of Debian freshly installed. 
  2. You only downloaded the first .iso and it is no longer mounted. 

Some folks can possibly skip ahead to Step 2.

Step 1: Remove CDROM from your sources

The first thing you’re going to need to do is get rid of the cdrom entries in your apt sources. If you try to install (or update) and have cdrom listed in your sources then you’ll bump into some errors. So, let’s take care of that.

Start your terminal with the trusty CTRL + ALT + T.

To fix that cdrom thing we’re going to need to edit your ‘sources.list’ file. To do that, we enter this in the terminal:

Find the line that starts with ‘cdrom’ and put a # in front of the line to comment it out. It should look a bit like this:

edit debian's sources list
That’s opened after editing. Your version may look different.

Next, save it. Seeing as we’re using nano, you do that pressing CTRL + X, then Y, and then ENTER.

At this point, we need to make sure the system knows we made that change. So, we’re going to update the lists of software available with this command:

That shouldn’t take all that long, especially if it’s a new installation. It takes even less time if you grabbed updates during the installation process. 

Step #2: Install software-properties-gtk

Seeing as you already have your terminal open, you needn’t open a new one. We can do the rest of this in just a single command. It’s actually really easy to do the rest, to set it up to graphically manage Debian’s repositories. Just enter the following command:

Press the ENTER key, type your password if asked, and press on the ENTER key again after entering the ‘y’ response if/when asked.

That’s it. You’re done. When you look in your menu, you should see a new entry called “Software & Updates”. Root around in the tabs and revel in your new tool to manage repos and a few other things.

Software & Updates on Debian
See? Mission accomplished and it wasn’t even all that painful! Congratulations!

You manage the main repositories on the first tab and can manage other repositories with the second tab. You can graphically manage Debian’s repositories without a whole lot of extra work. The hardest part was in removing the cdrom from the software sources. There are some other tools included, but those are the two main tools – or the two main tools that this article focuses upon.

Closure:

And there you have it! You have a new article. This one told you how to graphically manage Debian’s repositories. All in all, I’d say it’s pretty easy and something a fairly new user should be able to do on their own. Good luck and ask questions if you get stuck.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.