Upgrade Linux Mint In The Termanal

If you have chosen Linux Mint as your distro then you have a handy GUI way to upgrade, but today we’ll upgrade Linux Mint in the terminal. This won’t be entirely pointless, as we’ll be doing things the GUI method of upgrading doesn’t do. By the end of this article, you should be comfortable upgrading your system in the terminal.

Additionally, this is going to work for other related distros. This article will apply to you if you use Debian, Ubuntu, an official Ubuntu flavor, and many other distros. More specifically, if you have access to apt, this will apply to your computer.

There are a few confusing terms here. I’ll do what I can to explain.

We often use ‘update’ and ‘upgrade’ interchangeably. I do that myself. In the sense of this article, an update means you’re refreshing the software available to you and then you’d upgrade to the newest versions of that software. So, in the sense of the commands used, they’re not interchangeable.

We’ll be using apt for this article. APT is short for Advanced Package Manager. This is the most common method of managing packages in the terminal, at least for those distributions that use apt. If you check the man page, you’ll see:

apt – command-line interface

And that’s not too descriptive. If we read on, we’ll see:

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

That’s a bit more promising, as updating and upgrading is indeed managing packages. So, that’s what we’ll be using and you won’t need to install anything if you’re using Linux Mint.

Upgrade Linux Mint In The Terminal:

As you can see, I mentioned that this is to be done in the terminal. That means you need an open terminal. Just press CTRL + ALT + T and your default terminal should open.

With your terminal now open, let’s update the database to see what new software is available for your system. That’s an easy command:

The output will tell you to do so, but you can check the available upgrades with the following command:

You could update them manually, one by one, but you can just use this command:

That will install all of your available updates without asking you for permission to proceed. If the updates do require manual input, it will stop to ask you for your input.

Now, there’s another tool. We can clean up after ourselves, removing software that doesn’t need to be installed anymore. This happens and happens with some regularity. You can run the following command:

If you’d like, you can combine all these commands into a single command:

You can alias that, or leave it in your Bash history, and run that regularly to keep your system updated with the latest (and most secure, generally speaking) software.

Closure:

Yup… It was still a weekend when I wrote this. I also have guests that will be here for a while. So, it’s a fairly short article – but it’s a useful article for those who are running Linux Mint. After all, it’s not all that challenging to upgrade Linux Mint from the terminal and that’s something all Linux Mint users may wish to learn. If you’re in that group, this article is for you…

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Reinstall A Package In Ubuntu

There may come a time when your software has gone awry and you’ll want to know how to reinstall a package in Ubuntu. This article will cover this because it seems like a fine (and short) article and this is indeed a weekend article.

While this is specific to Ubuntu, it’s going to work in any distro out there that uses apt or apt-get. Technically, I’m doing this in Lubuntu, but Ubuntu is a more widely searched term. That’s why I’m going with this one.

So, what are we doing?

Well, we’re going to reinstall a package, that is software, in Ubuntu. We’ll be doing so from the terminal and it’s a very easy process. We will be using the terminal, so open your default terminal by pressing CTRL + ALT + T.

The tools… You won’t need to install anything new!

apt:

If you’ve installed software in the terminal, you’ve probably used apt (Advanced Package Tool). If you do some digging, you’ll see that it’s a front end for apt-get (which is in itself a front end for dpkg, more or less). Apt is the less-stable binary compatible with apt-get. If you want something long-term, use apt-get. If you’re writing an article for this moment in time, feel free to use apt.

When you check the man page, you’ll see apt is described like so:

apt – command-line interface

That’s not particularly helpful. Let’s check the real description:

apt provides a high-level commandline interface for the package management system. It is intended as an end user interface and enables some options better suited for interactive usage by default compared to more specialized APT tools like apt-get(8) and apt-cache(8).

So, as you can now see, this is the correct tool for the job. We’ll definitely be doing stuff in the ‘package management’ category.

apt-get:

I’ll be including apt-get commands by default. Why? For the sake of completeness. It’s not that much effort to add them and the article would be shorter without them. So, I’m using them. Let’s check the man page…

apt-get – APT package handling utility — command-line interface

That’s descriptive enough. You can see that apt-get is a package handling utility and that’s what we’ll be doing. We’ll be handling (managing, if you prefer) packages. 

These sorts of tools are installed by default on Ubuntu. They’re also installed by default on Lubuntu, Mint, ElementaryOS, Debian, and many more Debian derivatives. As I said, you won’t have to install anything new for the sake of this article.

Reinstall A Package In Ubuntu:

Let’s say you have some software that’s not behaving quite right. One of the steps you might take is reinstalling the software. Bits may go awry and sometimes things get messed up as you tinker. For whatever reason, you may want to know how to reinstall a package in Ubuntu. Again, that’s what this article covers. (So many people skip the intro!)

I’ve already told you how to open a terminal. This is done in the terminal.

First, we want to talk about how you reinstall a package. The syntax is simple:

You can do the same thing with apt-get.

That will reinstall an application, all nice and easy. It will only reinstall the application. Many applications don’t stand alone but have dependencies.

Fortunately, you can not just reinstall a package in Ubuntu – you can reinstall a package in Ubuntu and reinstall the dependencies. You just need to know what the dependencies are. For that, you’d run this command:

Once you have that information, you can combine the whole thing into a single command. All you need to do is add the package names to the commands. For example:

So, it’s pretty easy to reinstall a package in Ubuntu. 

Closure:

Technically, this was written on a Friday. It’ll be published on a Saturday. So, it’s a weekend article! That means it’s fairly short and fairly easy. I might as well have an easy day. Besides, I wrote another article already today. You won’t see it for a while, but it is written and scheduled for publication. I’m kind of ahead of the game in some regards.

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Installing Applications With DPKG

If you are installing software via the terminal, you may want to learn more about installing applications with dpkg. It’s a simple process and I’ll also cover how to uninstall software with dpkg. It seems like the thing to do and it seems like a handy article to write, especially for new users.

You should probably know that apt is a frontend for dpkg and I’d suggest using apt to install software. That article does mention dpkg, but this article will be exclusively about installing (and removing) applications with dpkg.

The main reason I’d suggest using apt instead of dpkg is because apt will manage dependencies automatically. That’s a pretty handy feature. Still, you might as well learn to install applications with dpkg. You might as well also learn about uninstalling applications with dpkg.

This article only applies to distros that support dpkg as their package manager. That’d be distros like Debian, Ubuntu, Mint, and the many other Debian derivatives.

What is DPKG:

You won’t have to install anything. If your distro supports dpkg, it will be installed automatically. You can verify that dpkg is installed with the following command:

The reason for this being a Debian (and derivative) thing is obvious when you check the man page. If you do that, you’ll learn that dpkg is:

dpkg – package manager for Debian

Installing software is definitely managing packages. That means this is one of the correct tools for the job. There are graphical ways to do this and you can easily install software with gdebi.

Anyhow, you can even visit the dpkg homepage. That’s the tool we’ll be using to install software.

Installing Applications With DPKG:

This is one of those articles that requires an open terminal. That’s a fairly common thing around here and most of you know that you can open your default terminal simply by pressing CTRL + ALT + T.

With your terminal open, let’s all start on the same page…

In our example, we’ll use XnView MP. You can download that with this command:

If you’re using a 32-bit distro, there’s no current XnView MP available. They’ve stopped development, but you can download an older version.

Now that you have XnView MP downloaded, you can install applications with dpkg with the following syntax:

Or, in our case, we’d install XnView MP with this command:

(Don’t forget that you can use autocomplete.)

See? It’s fairly easy to install applications with dpkg. I picked this XnView Multiplatform because it doesn’t have any dependencies in my testing. That keeps it relatively simple.

If there were dependencies, you could install them manually with dpkg. You can do that, or you can just use apt (which, again, you probably should have used in the first place). To do that, it’s simple:

If you’re going to have to run an apt command after installing applications with dpkg, you might as well use apt in the first place. When you install packages with apt it will also resolve any dependencies (if those dependencies can be satisfied).

Removing Software with DPKG:

Yes, you will still need an open terminal if you want to remove software with dpkg. It only stands to reason. So, if you’re here for just this section of the article, open your terminal. There are directions above if you’re new to Linux.

The syntax to remove software with dpkg is also quite simple.

NOTE: The package name is going to have a different name than the installation package, lacking at least the .deb portion. You can find the name with this command:

So, in our example, we’d try a command like this:

Sure enough, it returns this:

So, we can see the application name is not the same as the package name. In this case, the name is ‘xnview’. That means we’d use this to remove the package:

That removes the application but it retains the configuration files. This means you can install the application at a later date and still have the same configuration you had before you removed the application.

See also: ‘sudo apt remove’ vs ‘sudo apt purge’

If you want to uninstall the application and remove the configuration files, you can just use the -P (purge) flag. The syntax follows:

If we use this command with our example application, it’s like this:

Now, if you want to pretend this article never happened, we can clean up after ourselves with the following command:

That will delete the .deb file, meaning we’ve left no evidence behind (assuming you purged the application). Of course, you no longer have that particular graphics viewing, organizing, and light editing application installed. That’s entirely up to you.

Closure:

Well, if you ever needed to know about installing applications with dpkg, this was the article for you. We even discussed the process of removing the application and cleaning up after yourself. Good times!

If we wanted to be ‘more correct’, we’d say that we started with a package and installed an application. I figured I’d aim at the more generic words in hopes that newer users find this information and find it relatable.

There’s a limit to what you can ‘optimize’ for (meaning ranking in search engines) so I do what I must. I work on SEO (search engine optimization) because the site’s pointless if it doesn’t help anyone.

The whole goal is to get my notes (and more) online so that the site becomes a resource. More specifically, the end goal is to make Linux more approachable. Now if I could just make the site break even…

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Playing With Your Bash History

Your Linux computer, assuming it’s ‘normal’ will retain the commands you typed in the terminal and this is your Bash history. Like all things Linux, this is something you can control. The ability to customize these things is one of the things that makes Linux great!

More specifically, this article will cover how to change the Bash history size. That’s one of the things you can control. It’s one of the settings you can customize. You don’t have to accept the default Bash history size. It’s easy enough to change those settings to whatever you want.

I’m going to assume ‘normal’. That is, normal to me. I’m going to avoid the word ‘standard’ because I don’t know if these things that are normal to me are standards. For example, even the Bash shell isn’t a standard. However, it’s normal for a Linux distro to provide Bash – typically as the default shell. It’s not a standard, it’s just normal. That is, normal to me.

Got it?

Well, your Linux computer usually uses Bash shell. It also normally keeps a history of commands you type. This file is normally a hidden file, called .bash_history and is a plain text file. 

Bash has a control file. That is, Bash has various settings that can be configured. This file is also normally hidden. It’s usually called .bashrc. As this is about the shell and Bash, you will need an open terminal to follow along with this article. You can normally just press CTRL + ALT + T to open a terminal.

What is the Bash shell?

Bash is a Unix shell. It stands for Bourne Again Shell. It has long since been ported to Linux and is what you’ll normally find when you look into the more popular Linux distros.

A shell is a command line interpreter. It’s a user interface that lets you interact with your computer in a text-based manner. There are other shells besides Bash, but this article isn’t going to cover any of them.

This article presumes you’re using the default Bash shell. If you’re curious, here’s a big comparison of shells. Some people like to use different shells with csh and and zsh being popular choices. 

Bash is just one of many possible shells, but it’s normal to see Bash as the default. If you’re not using Bash, this article may not apply. You won’t see me writing much about other shells, as I’ve mostly just used the default shell rather than spending time exploring other options.

Bash History:

As mentioned above, you usually have a .bash_history and Bash usually stores the commands you’ve entered in that file. That file is plain text, meaning you can search it, edit it, or even modify it. I’ve written some about Bash’s history before.

Search For Command History By Date
Dealing With Duplicates In Your Bash History
Let’s Delete An Entry In Your Bash History
How To: Not Save A Command To Bash History

This shouldn’t be a foreign concept to my regular readers, though I’ve not written much about Bash recently. This seems like a fine time to cover this subject.

Today, we’re going to change the Bash History Size. There are three variables you’ll need to know. Well, you can get away with just knowing two of them, but we’ll learn all three.

Bash History Variables:

As I said, there are three variables we’ll be using to control the size of your Bash history. They’re all pretty simple and they all control one aspect of the Bash history.

HISTFILE:

The first variable is ‘HISTFILE’ and you can echo this to get the information. The file is normally located at ~/.bash_history but you could change that value and have the history file anywhere you want. You can find the Bash history location with this command:

The output would look similar to this:

HISTFILESIZE:

The next variable we’ll concern ourselves with is ‘HISTFILESIZE’. This is how long, specifically how many lines, will be saved in the .bash_history file. You can your current configuration with this command:

Again, the output from that command might look similar to this:

That means the .bash_history file can be up to 2000 lines. That’s quite a bit, but not far from normal. I think I’ve messed about with it before, so I’m not sure if that’s the default. Just echo the variable to find your current settings.

HISTSIZE:

The next variable is going to be  HISTSIZE which is how many lines your shell should retain in memory. If the HISTSIZE is set to 20, you’ll have 20 lines of history to scroll back to visit. You can get the HISTSIZE settings with this command:

An example output might look like this:

NOTE: This can sort of be overridden by your terminal client. If you have a $HISTSIZE of 1000 and your terminal preferences (some terminal emulator clients have this setting) are set to 500, you’ll only have 500 lines kept in the cache at any one time. However, the number of cached commands is still 1000 – but your terminal will not show them.

We can change these variables!

Change Your Bash History Size:

Now that you know the default size settings for your Bash history, you can go ahead and learn how to change the settings for your Bash history. While it’s possible to change the location of your .bash_history file, there’s no need to.

We’ll worry about our Bash history size, that is how many lines the history file will hold. Anything else is superfluous so we’ll skip it.

The first variable you might want to change is the total number of lines that will be stored in your history file. That’s done like so:

If you want your Bash history to hold 5000 lines, the command would look like the following command:

That won’t take effect immediately. You’d have to reboot or close all the terminals before opening a new terminal for the new settings (reloading what is normally called .bashrc) to take effect. However, you can force the issue with the following command:

If you want to change the value for the maximum number of cached commands a shell can retain in any one setting, you can use the following command:

If you wanted to match the HISTSIZE with the new HISTFILESIZE, that’s easy enough to do. Just enter the following command to change the value for HISTSIZE:

Just like before, you’ll have to tell Bash to reload your settings because they’ve changed. Rather than close things, log out, or reboot, just enter the following command for the HISTSIZE change to take effect immediately:

Note that none of these commands require sudo. If you are having to use elevated permissions, you’re doing it wrong. Well,  you could be modifying the settings for another user but that’d take direct editing of the .bashrc file and you’re better off modifying that file when logged in as the user.

Closure:

Well, that was a pain in the butt to write and format. I hope that it’s not too confusing. I kept typing the variables wrong and this article about changing your Bash history settings required quite a bit of advanced formatting. That takes time, which means this article took time. Still, I wanted to cover the Bash history configuration choices and I wanted to do them all in a single article.

This article is much longer than my normal articles. I dare say that I’ve changed my writing style – again. I’ve been doing longer format articles. Previously, I’d have only covered the $HISTFILESIZE variable and left it at that, without adding many links or much additional information. I do welcome feedback and suggestions.

If you don’t like the longer format, say so. If you do like the longer format, say so. Hell, if you read the closure section say so! I don’t know if I’ll change much based on the feedback, but it’s good to know. Lately, I’ve been pulling down quite a bit more traffic, so something must be working. I’m no SEO expert, so I do what I can and follow directions from people who have had more success. But, the site is coming along nicely.

Amusingly, I’ve had almost no emails on the advertising subject since I added the Sponsorship link. I should mention that it’s possible to sponsor an article even if you’re not a business. I’d just put in a ‘thank you’ notice and link to pretty much anything you want if you did indeed want a link. This site has a solid reputation, but it’s still growing – and growing pretty quickly as of late.

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Monitor Progress With RSYNC

When you’re moving a lot of files around you might want to know the progress, so here’s how you monitor progress with rsync. This will likely be an intentionally short article, an easy article, as it’s another weekend article – this time about rsync and how you can monitor the progress.

The rsync application is a tool for transferring and synchronizing files between two places. It’s a very handy application and rsync has a whole lot of features. It’s possible to write a half-dozen rsync articles and not even scratch the surface. We’ve had rsync available since the mid-90s and you can visit the rsync project page.

You’ll almost certainly not need to install anything to use rsync. It’s pretty much available with every distro though I’ll mention ahead of time that this is a terminal-based application. By the way, if you’re not happy with your terminal, you can change to a new default terminal easily enough.

There are frontends for rsync, such as luckyBackup, but we’ll just be using a plain old terminal for this article. If you play with luckyBackup, you’ll discover that you can use it to spit out the actual rsync command you’ve configured and use it in the terminal without any additional overhead.

RSYNC:

If it’s not obvious, the tool we’ll be using is rsync. Specifically, we’re going to monitor the progress as rsync synchronizes your data from one place to another. It’s going to be a very easy article, I promise. Well, I think it’s easy. I suppose I could be wrong and you find it more difficult.

You shouldn’t need to install anything to follow along. You can first verify that you have rsync installed and available. Use this command:

If you don’t have rsync available immediately, I’m sure you can install it from one of your default repositories. If it’s not installed by default, let me know. I’m curious…

Anyhow, you can check the man page (with man rsync) to learn more about this application. It’s a rather long and complicated man page, but rsync is described as:

rsync – a fast, versatile, remote (and local) file-copying tool

And that’s what we want to do. We want to monitor the progress of file transfers. So, that’s what we’re going to do.

Except, I’m also going to show you how to make a simple backup of your data as a bit of bonus information. Let’s get on with it!

Monitor Progress With RSYNC:

Now, I did tell you that you’ll need an open terminal for this. That’s easily done. More often than not, you can open your default terminal by pressing CTRL + ALT + T. Otherwise, you can find it in your application menu.

With your terminal now open, your standard command would be something like this following rsync command:

To monitor progress with rsync, you’d add the --progress flag, like so:

That’s all well and good, but let’s pretend you want to make a backup of your home directory with rsync and that you want to monitor the progress. Well, you can happily use rsync with directories. This is going to be pretty easy!

The -r flag means ‘recursive’. That means it will include the files in the directory you specified, find the additional directories within that directory, and include those files. It will keep digging until there are no more directories unless you decide to specify a maximum depth.

Let’s further assume you have a USB device plugged in and you want to store your home directory on that USB. Let’s also assume that the USB’s called ‘backup’. The command for that would just be something very close to this command:

That might look something like this:

showing the progress of rsync
As you see, it’s easy to monitor the progress of rsync. Yes, that’s Windows ME. Don’t judge me!

That command will move all the files from your home directory (as we know that ~/ is a short way to say your /home/user directory) to your USB device. You’ll have then backed up your personal data. The second time you run it, it will sync those files – only replacing those files that have changed since the last time you ran the command.

You can easily use that command (modified for your needs, of course) to make a backup of your home directory. This is the most important data on your system. The rest is just system files and those are easily restored with a fresh installation.

While it would be possible to use rsync to backup the entire drive, it’d try to do stupid things like backup the /media directory. You’d need an advanced command for that and that’s beyond the scope of this article.

As it stands, the backup bit is extra. This article is just about how you can monitor the progress with rsync. It’s a pretty trivial thing, but something you can learn about quickly.

Closure:

Yeah, it’s a pretty short and easy article. At least I hope it’s easy. I did make a promise, after all! This one should be easy enough for anyone because it’s not all that hard to learn how to monitor progress with rsync. Also, with a reasonably large file, you can do things like check transfer rates, be it over a network or from one drive to another. There’s all sorts of fun!

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