Let’s Learn Some apt Basics

Today we’ll be learning a little about some apt basics. This is only useful if your distro uses apt to manage software. If you aren’t using a distro that does (Debian, Ubuntu, Mint, etc) then this probably isn’t an article that will interest you much, and that’s fine. With the great variety there is in the Linux world, it won’t always be an article that matters to you. Better luck tomorrow! Well, two days from now… 

In the past we’ve covered quite a few apt commands. Here are a few that are poorly formatted ’cause, you know, WordPress…

How To: Clear The apt Cache

Use ‘apt’ To Download A Program And Its Dependencies

Use ‘apt-cache’ To Find An Application’s Homepage

Those are a few – but there are actually more than that. If you’re unfamiliar with apt, you can click any of those articles and learn more about it.

For those of you whose systems use apt to manage packages, this article is for you. If you aren’t aware, apt is the package manager application that you’ll interact with more often than not (if you do things in the terminal).

Apt has a number of commands, of course. As a package manager, it’s bound to be a robust and potentially complicated application. Today, we’ll just be covering a few simple apt commands that you’re most likely to use. It will not be an exhaustive article because of time constraints, reader attention limits, and usefulness. My goal was never to replicate man pages. You’ve still gotta read ’em.

So then, without further ado…

Some apt Basics:

If you want to use apt, you have to have an open terminal. If you don’t know how to open the terminal, you can do so with your keyboard. Press CTRL + ALT + T and your default terminal should open.

With your terminal now open, you can easily install applications with apt. You’ll need to know the package name for the software you want to install, however. So, you can search for packages easily enough:

For example, you can use ‘terminal’ in there as a keyword and get a ton of options, all of which should be installable easily. Again, these are just apt basics.

Now that you know, or you may already have known, the package name, you can install it with:

You don’t need to do the runaround with dpkg for local .deb files, by the way. I’m not sure why people still suggest that? If there’s a good reason for doing it that way, please let me know in the comments. You can just use apt and it works just fine – including resolving dependencies (when they’re able to be resolved). To install a local .deb file with apt:

If you want to get the information for a specific package, you can use the ‘show’ command. That’s easy enough:

If you want to see the dependencies, that is the other applications that need to be installed in order to make it work, then you just check the dependencies with:

If you want to remove a package with apt, then you can just read this article to decide which command is right for your needs:

‘sudo apt remove’ vs ‘sudo apt purge’

That’ll answer it nicely enough.

Closure:

There you have it. You have an article about apt basics, and that’s all it is. You’ll note that not all apt commands need elevated permissions, so there’s no need to use sudo unless you’re adding or removing software. The other commands can be run without elevated permissions.

There’s more to apt. Yes, yes there is. Type man apt and you’ll get an idea of the available options. This article is just some apt basics, the things I think you’re most likely to need on a day to day basis. 

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.

How To: Clear The apt Cache

In today’s article, we’re going to learn how to clear the apt cache. This is only useful if your distro uses the apt package manager. If your distro doesn’t use apt, this article is of no use to you. This isn’t a complicated article, but it’s one that should probably be included on this site.

If you don’t know if your distro uses apt, you really need to pay more attention! However, run ‘which apt‘ in the terminal and it’ll let  you know if apt is present.

If you’re using Debian, Ubuntu, an official Ubuntu flavor, or any derivative thereof (such as Mint), you’re using ‘apt’ as your package manager. Of course, if you’re new and not all that familiar with apt, you’re able to use this site’s search feature and find out some more information. Feel free to do so, as I’ve written a few articles on various apt features.

If you want, you can read this article from FOSSLinux for a great rundown on APT vs aptitude, that’ll also answer some other questions along the way. It’s a great article to understand apt, not just the differences between apt and aptitude.

When you install applications and updates with apt, the .deb files are cached on your device. In time, this can build up and use more space than you really want to have spent on such a feature. So, let’s learn how to clean it.

Clear The apt Cache:

Obviously, this article requires an open terminal. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

Now, you can see what is going to be deleted – which directories that is – by using the dry-run flag.

Those are the directories which will be cleaned. The first command you might already know is this one, which seems to be one of the favorites for new users:

However, that only removes cached packages if there’s a newer version in the repositories. I don’t really see much use for that, but it’s there, a feature, and often a command that newbies are told to run.

Instead, you can clear out all those directories of no-longer-needed .deb files. Just run the first command without actually doing a dry run. It is done like so:

That’s really all there is to it. I mostly wanted to ensure folks knew how to clear the cache – and that the difference between the commands was mentioned somewhere on the site. I don’t expect the site to be some giant repository that’s ‘complete’, but I do need to cover the basics now and again.

Closure:

Well, today you’ve learned to clear the apt cache. Again, this isn’t going to do you any good if you’re using RHEL, Fedora, or even Arch! But, if you use a distro that uses apt, you might as well know this information. And, well, now you do…

Also, I linked to another site with similar content! I don’t do that often! Their write-up was just too good to pass up, so I don’t mind sending them the traffic. It saved me like an hour’s worth of writing – while trying to fit it into a block of no more than 300 words. So, I’m very, very much okay with linking to content like 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.

How To: Add A PPA To Ubuntu

In this article, we’re going to discuss how to add a PPA to Ubuntu. A PPA is a Personal Package Archive, but we’ve come to use them much differently than they were ever intended. So, you might as well learn how to do this. You might as well learn how to add a PPA to Ubuntu.

Yes, we use PPAs in ways never intended. They are meant to be your own personal archive of packages. not a way of disseminating software to the masses. We’ve turned PPAs into a tool to widely distribute software more easily. If you want a piece of software that’s not in the official repositories, you do a quick search, add a PPA, update, and install your software! It’s how we’ve always done things! (Hint: No, it’s not how we’ve always done things.)

This is one of the main reasons Snap apps were created and why they are being pushed. During this time, people could also have used AppImages and Flatpaks, and some of us did.

Me? I’m among the worst of offenders. As it is, I still only use Snaps that came installed by default. I still reach for a PPA (when available) and install things in the ‘traditional’ manner. Well, it’s hardly traditional and it’s generally a bad idea.

In fact. let me sum up why it’s a bad idea with just one sentence…

When you add a PPA, you’re giving the PPA maintainer root-level access to your computer.

All they gotta do is push an update and you’ll have installed it with your next upgrade. No, don’t pretend you’re going to read the source and verify the integrity. You’re going to do it, just like you wanted to …

Add A PPA To Ubuntu:

Alright, let’s paint a simple picture:

There’s some software you want, but you can’t find it in your repositories and the GitHub page doesn’t release packaged binaries. You don’t want to have to deal with building it every time there’s a new version, so you take to the ‘nets in search of a fix.

Your first stop is at Launchpad.net to search for the application. You got lucky and found a PPA. In fact, you found a few of them. In this case, you want to look for the one who has most consistently published upgrades. First, you have to enable Ubuntu’s ‘universe’ PPA, which may already be enabled. If it isn’t, the command to run is:

When you find the proper repository’s name, you can add it with this command:

An example of that could be sudo add-apt-repository ppa:mozillateam/ppa. You could use that to use the more traditional Firefox. 

No matter… Once you’ve done all this,  you might still need to update your own local software database with this command:

There you have it. You can now add a PPA to Ubuntu. You can now use the software included in the newly added PPA. Modern/current Ubuntu flavors will run the apt update automatically, but older versions will still need to trigger the update manually.

BONUS: You can more easily remove the PPA through the GUI, but you can also do so in the terminal, it’s just the –remove flag, like this;

See? You can now do both. You can add a PPA to Ubuntu or you can remove a PPA from Ubuntu.

Closure:

Ah well… You can now add a PPA to Ubuntu. Removing a PPA is also now something you can do, assuming you didn’t already do so. On top of that, adding PPAs willy-nilly as  you’re essentially giving that PPA’s owner a key to your entire computer.

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.

Enable PPAs In Elementary OS

Today’s article will tell you how to enable PPAs in Elementary OS. This is generally considered a bad idea, but it’s your computer and you can do anything you want with it. So, well, this one will have you enabling PPAs in Elementary OS.

I suppose that some folks will have no idea what I’m talking about. So, I’ll point out that Elementary OS is a Linux distro. Also known as eOS, it seems  targeted at looking good, having cohesive apps, and charging you money for this. That’s fine. You can use it for free.

Elementary OS is based on Ubuntu, which is based on Debian. Ubuntu has PPAs, a way to install software that’s not in the default repositories, but Debian does not. Some Ubuntu derivatives also do not allow PPAs (by default) and Elementary OS is among those that do not.

Elementary OS developers would prefer you use AppImages or Flatpaks, instead of accepting the security burden that is allowing PPAs. After all, any PPA you add is pretty much like giving someone root access to your computer.

Well, today’s article is about just that. It’s a quick article that’ll teach you how to use PPAs in Elementary OS. Heck, the command to enable this is shorter than this intro, where I show you how to…

Enable PPAs In Elementary OS:

To get started, we’re going to have to have one of those open terminals. You can root through your menu (or use the search feature) or you can just press CTRL + ALT + T and your default terminal should open.

Next, to enable PPAs in Elementary OS, you really only need one command. But, we’ll make sure you’re updated fully before trying this. Thus, you get two commends!

Now that you’ve done that, you can now add PPAs to eOS. If you wanted to keep up with the more recent versions of LibreOffice, you’d run the following commands:

That should install LibreOffice and then keep it updated as the PPA maintainers update the repository. Either way, congratulations! If you’ve done everything correctly, you can now enable PPAs in Elementary OS.

Closure:

There you have it, another article. This article tells you how to enable PPAs in Elementary OS. Their preferences for different packages isn’t too dissimilar than Ubuntu themselves recommending Snap applications. Plus, any PPA you add will the be able to install software by its very nature, Maybe it is time to start doing away with the old ways and moving towards modernity?

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 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.

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