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.

Use ‘apt’ To Download A Program And Its Dependencies

In this article, we’ll discuss a way to use ‘apt’ to download a program and its dependencies. The usual reason to do this is to install said program on an offline computer. We’ll be doing it all nice and neatly, just using the ‘apt’ application along the way. It won’t be all that difficult, but will be easy to link to and reference.

As I said, the usual reason to do this is because you have a computer that’s not online and you want to install some software on that computer. This could be a remedy for when you need wireless drivers in order to connect the device, or other sorts of situations. It’s a handy way to get those drivers up and running, so we might as well learn how to do so today.

We’ll be using ‘apt’ for this. We’ve used ‘apt’ for all sorts of software management tasks in the past. In fact, in the past this required a bit more effort. You’d use the ‘–download-only’ flag and get some files in your apt archives directory. Today, it’s just a quick task that outputs a handy file that is extremely portable.

In fact, this article really only needs one command, making ‘apt’ do its thing. It’s not all that difficult, either. By the way, if you don’t already know, ‘apt’ stands for Advanced Package Tool. Anyhow, I’ll still make it an article – as it’s a useful one to know and reference.

Download A Program And Its Dependencies:

This article requires an open terminal, like many other articles on this site. 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.

With your terminal emulator now open, you need to know the name of the program you want to download. For example, I tested this with ‘openjdk-17-jre’ and it worked as expected. (For the commands you’ll use, I’ll just use my traditional brackets.) Before I tested with openjdk, I made sure it had dependencies, and it did. To see if it had dependencies, I used this command:

Once you see that it has dependencies, you can go straight to downloading the program and its dependencies. You no longer need any long commands, it’s just (even if it doesn’t have dependencies):

All you have to do at that point is wait for the files to download. When they’re done downloading you can find the file in your ~/Downloads directory combined into a single compressed file. In my case, the filename was openjdk-17-jre.tar.gq and the download completed without error.

The process is the same if you have dependencies or not. The reason we pay attention to dependencies in this article is so that you know to check and make sure those dependencies are included, so that you’re able to install the software on your offline computer.

And, with all that said, now is a good time to verify that it contains all the files it should contain. Assuming the files are what you expected, with dependencies as needed, now is the time to sneakernet them to the offline computer, where you can install the program by first installing the dependencies before installing the program.

NOTES: It does build an ‘install.sh’ which should let you install the program and dependencies in one fell swoop, but it accessed the ‘net in my testing. So, just do ’em manually if you want to be sure, otherwise make it executable and give it a shot. This will only work if the versions are all compatible with the offline computer. If that’s not the case, you could end up in dependency hell or perhaps not able to install the program at all.

Closure:

And there you have it… You have yet another article! This one is handy if you want to install a program and its dependencies on an offline computer. It may also be handy if you want to establish a base-line and standardize on that specific version of the software. In that case, you’ll have a copy of what it once was. It’s something you can reference and restore as needed. But, yeah, it’s most likely to be used by people who want to install software on offline 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.

Install The Full Version of Vim In Ubuntu

Today, we’re going to show you how to install the full version of Vim in Ubuntu. Along the way, you may learn a few other things, but the process is simple enough. Even a new user can follow this article – I’d assume. I mean, I could follow it. I think…

Though, I’m not sure that a new user would opt for learning Vim. Either way, some of us will learn something from this article, even if it’s just me learning something from writing it. After all, if I read the headline aloud to you, our conversation might realistically start with this:

“But, KGIII, Ubuntu already comes with Vim installed!” You might say. “You don’t need to install it. D’uh!”

To which I’d respond, “You’d think so, and it appears to, but it actually only comes with a limited version of Vim. Watch, I’ll show you! Then we’ll install the full version of Vim.” 

See? It's a small version of Vim.
Check the highlighted line. See? It’s just the small version of Vim. It’s not the full version.

NOTE: We won’t be worrying about a GUI version of Vim. Maybe we can cover that in another article, but you can probably figure that one out on your own.

Now, Vim stands for Vi Improved, with Vi being a really, really old text editor (circa 1976) and Vim is an improvement on it. You’ll see it written as ViM or VIM from time to time, but if you go by the description in the man page, it’s simply “Vim”. Because of that, I’ve decided to spell it that way.

Actually, now that you know the initially installed Vim is just the small version (hint: tiny version), you can probably figure out the rest on your own. I have faith in you, my dear readers. Yes, yes I do… Still, I’ll tell you how, otherwise it’d be a pretty silly article!

Install The Full Version of Vim:

You’re going to want an open terminal for this one. 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.

With your terminal open, run the following command:

Next, we want to install a full version of Vim. To do that:

There are also some GUI versions of Vim that may be in your default repositories. You can opt to install those, but we’ll not be covering those in this article. This article is just about how to install the full version of Vim.

Hmm… Well, that’s really all there is to it. I suppose you could string the commands together, all nice and fancy like…

Yeah… So, really, that’s all there is to this. However, the important thing is that most folks don’t realize that it’s not the full version of Vim that has been installed by default. It’s just the tiny version, which is lacking in features. If you want, you can verify the currently installed version of Vim with this command:

Assuming you’ve installed the full version of Vim, the output will look similar to:

The output shows that this is the full version of Vim.
Again, check the highlighted line to see the difference. As you see, it’s the full version. Sweet!

Closure:

Well, there you have it. You now know that Ubuntu’s initially installed version of Vim is just the tiny version of Vim. You also now know how to install the full version of Vim in Ubuntu. If you’re a fan of Vim, or would like to start learning Vim, this is probably a good thing to know.

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: Completely Remove Software In Ubuntu

Today’s article is going to show you how to completely remove software in Ubuntu. This will also work for other distros that use apt as their package manager. It’s a pretty handy tool to have in your toollbox, because we’ll not only be removing software, we’ll also be removing any config files associated with said software. It’s not all that difficult, and anyone should be able to understand this article.

When you ‘remove’ software, be it with the GUI or with the terminal, you’re actually only removing the software itself. You’re often leaving behind the config files (if there are any) and the ‘remove’ may leave dependencies still installed. The reasoning for leaving config files behind is presumably so that you can reinstall the software and have the same configurations you had earlier in time.

As you can guess, that’s not always a good thing… It may well be those configuration files that caused some sort of error in the first place. It may well be those config files that prompted you to remove the software in the first place. Erasing and starting anew might be your only realistic path forward, especially if reverting to backups did not work.

So… That’s why we have this article. This article is going to teach you how to completely remove software in Ubuntu. If you want, you can still try removing software and reinstalling (as a troubleshooting step), and this then becomes one of your later troubleshooting strategies. Read on, and you’ll see…

Completely Remove Software In Ubuntu:

This article requires an open terminal, like many other articles on this site. 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.

When you remove software with the terminal, you probably do it like so:

That’s great. It removes the application and may even remove some of the dependencies it pulled in when you installed it. This is not necessarily a bad thing – but we want to completely remove software in Ubuntu, and this is how you do it.

As I said in the preamble, using the above command will likely leave your configuration files behind (if there are any) and some dependencies. With the ‘purge’ command, you’ll get rid of those configuration files. To do this, you’ll want to:

While that’s great and all, when you installed your application you may well have installed some other applications (dependencies), that is some applications that the software depended on. Those too may have config files related with them and to really ensure you’ve completely removed the software, you’ll want to do an autoremove. 

If you’re unfamiliar with the autoremove function of apt, the man page has it summed up nicely:

autoremove is used to 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 don’t specify an application with the ‘autoremove’ command,  you just run:

That should do it, actually. The last command should remove any dependencies that were installed and not removed automatically when you purged the software with the commands above.

Closure:

And there you have it! It’s another article! I still haven’t missed a day, and I’m well beyond my initial obligations. This time, the article tells you how to completely remove software in Ubuntu – and it’ll work in any distro that uses apt. It’s a pretty simple thing, but it’s worth knowing. Eventually, it’s bound to come in handy.

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.