Let’s Upgrade Fedora From The Terminal

Today’s a good day for a short article, like one on how to upgrade Fedora from the terminal. It’s a pretty easy task, yet one I have in my notes. I see no reason to not turn it into a nice, short article. After all, you might not know how to upgrade Fedora from the terminal!

Obviously, you’re going to need Fedora installed for this. Though, technically, I’m sure you could do this if you were trying the live instance of Fedora. I mean, you could…

Anyhow, all operating systems should get updates. If you’re not getting updates, something is wrong. The most obvious ‘wrong’ in this is that you’re using an operating system that’s no longer supported. By doing so,  and doing so online, you are not just a risk to yourself – but you’re a risk to other users.

For example, you could be compromised and become a part of a botnet. That’d be bad. So, stay updated – not just for yourself but to be a good member of the community. Use a distro that’s still supported.

Lest you think this is a weird article, I’ve actually also written:

How To: Update Ubuntu From The Terminal

See? ‘Snot the first time we’ve had this sort of article. 

Well, let’s get into it. Let’s learn how to …

Upgrade Fedora From The Terminal:

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 open,  you can start with a very simple command:

That’s “it”, I guess… Well, no… That’s all you need to do to upgrade your system. If your system requires a reboot, you do that with:

Now, here’s a little trick…

Let’s say your upgrade screwed something up. You upgraded to a new version of Thunderbird and you want to roll back to a previous version. You can do that without much effort. 

Obviously, change the name of the application to the application you’re having problems with. Well, each upgrade will have a number assigned to it and it’ll show that number when you run the above command. You use that number in this command:

That will undo the most recent upgrade to that application, restoring a usable application for you. You can then try it again when the application is next upgraded.

See? It’s a neat little trick with ‘dnf’. Feel free to check the man page, with man dnf, to see what other little gems you can find.

Closure:

See? I told you that it’d be a nice and easy article. This one isn’t difficult – but does have a neat feature not everyone knows about, that is how to rollback upgrades with DNF when you have chosen to upgrade Fedora from the terminal.

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.

Make wget Use IPv4 or IPv6

Today’s article is a fun one, an article where you learn how to make wget use IPv4 or IPv6. Not only is this useful, it’s easy! In fact, it’s easy enough for most anyone to figure out. Plus, this will be a fairly short article – I think. I mean, I haven’t written it yet, but it seems like a short one.

I’ve done a couple wget articles, with the most recent showing you how to make wget ignore certificate errors. In fact, in that article I showed you how to enable that permanently. I’ll have to add that to this article. That’ll come in handy for like 0.01% of you.

If you don’t know, wget is a tool for downloading content from servers. These days, we use it to grab stuff from web servers without having to go through a browser – more often than not. Sometimes we use it to scrape entire sites without actually visiting them in a browser! (Sometimes, doing that makes you a dick.) It’s a handy tool for that sort of stuff.

Once in a while, while using wget, you’ll come across a finicky download that will throw an error about wanting IPv6 (or IPv4 if you’re using IPv6). That’s when this article is going to come in handy. Sometimes, a server isn’t configured for, or will refuse connections from, one or the other. That’s when you’ll see errors and that’s what we’ll resolve in this article.

Hmm… Do I need to explain wget more? Nah, y’all know what it is. IPv4 vs IPv6? Well, how about you check out this link to learn the difference and why it matters. That’s a good link. Alright, moving on…

Make wget use IPv4 or IPv6:

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. The wget command will throw an error, letting you know if you must use one or the other.

If you need to force IPv4, it’s nice and easy:

If you need to force IPv6, it’s also nice and easy:

If you find yourself doing this often, one way or the other, you can actually tell wget to do this on a permanent basis. Like in the previous wget article you can edit your .wgetrc file (create it if it doesn’t exist) to include either --prefer-family=IPv4 or --prefer-family=IPv6 and it’ll try one before trying the other if it’s available.

Closure:

See? Nice, neat, and simple. You’ve learned how to make wget use IPv4 or IPv6 – should you find yourself needing to do so. It’s a handy trick to have up your sleeve, ’cause you will eventually find a server that requires one or the other. Given enough use, it’s gonna happen.

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 Install And Use ‘locate’

Today, we’re going to learn to install and use locate and we’ll even cover some basic usage. If you’re unfamiliar with locate, it does exactly what you’d expect – it helps you locate files on your computer. Read on for a basic understanding.

The locate command is a terminal-based command, a text way to find files on your computer. It can be a pretty useful command – with some advanced usage – but we’ll just cover some basics.

The locate command is actually installed by installing ‘mlocate‘. So, let’s just get that out of the way. Depending on the distro you use, it’ll likely be in your default repositories and you can install it much like you’d install any other software. For example, in a distro that uses apt you’d install it with:

You may have it installed by default. You can check that with:

If that spits out a version and some version information, you’ve already got it installed and there’s no need to install it.

Anyhow, with that accomplished, let’s learn a bit about how to …

Use Locate:

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.

Of course, you’d have had to open the terminal in the preamble, but I  might as well tell you again. With the terminal open, you can check the man page for locate. You’ll see it does exactly what you’d expect it to do:

locate – find files by name

To use the locate command, it’s quite simple. It’s ‘locate <flags> <file_name>‘ and really quite simple. It does what you tell it to do, nice and easy. 

For example, it may return a lot of results:

Or it can be quite targeted:

However, it needs a database to work from. If you’ve just installed the mlocate package, you’ll need to update the database. Hmm… I probably could have mentioned this sooner. Oh well… You’ll find it if you need it. It pays to read all the words, folks!

To update said database, it’s this command:

Now, there are a couple of useful flags. We’ll cover a few. You can just return a number of how many files match the description with the -c flag:

You can limit the number of responses with ‘-n <number>‘ easily enough:

The locate command defaults to being case-sensitive, but you can change that behavior with the -i flag:

Finally, you can check the database statistics with this command:

While there are other options for the locate command, including using it with other commands, those are the options I find myself using more often than not. I suspect those will be the most often used options when you too make use of the locate command. Be sure to check ‘man locate‘ for more information.

Closure:

See? It’s a quick and easy article about how to use locate to find files on your Linux computer. It’s not terribly difficult and it’s a handy command to have learned. As mentioned, the man page has even more options for you to use the locate command. Feel free to check ’em out.

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.

A Few Ways To Count CPU Processors Or Cores

So, in today’s article we’re going to learn a few ways to count CPU processors or cores. This is something you might already know about the system in front of you, but may want to verify with a remote system.

To the Linux system, there’s little difference between an individual processor or a core, or even a thread. Each core will appear as its own processor – and that’s exactly how it should be. Linux will treat each as its own processor and do its best to take advantage of multi-core/multi-CPU systems.

Now… Hmm… I shouldn’t need to explain this, but your computer has a processor called a CPU. It may have more than one, though that’s unlikely in a personal computer. Instead, your CPU may have multiple processors on it – each functioning more or less independently as ‘cores’. Additionally, your CPU cores may have multiple threads and each of those threads will appear as its own CPU.

That’s a very simplistic overview and I have to do things like limit how many characters are in the title of the article – and I don’t really want to try to explain everything. 

For example, you could have a 4 core CPU that’s dual threaded. 4 x 2 = 8, so your system will see 8 CPUs. There’s only one physical processor, but you’re effectively working with 8 of them. (By the way, you can *sometimes* compile software optimized by the number of cores available.)

Count CPU Processors Or Cores:

(or threads, I suppose)

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.

Now, there are so many ways that you can count the CPU processors or cores. We’re just going to cover a few of them. Feel free to leave other solutions as a comment. I’ll approve the comments as quickly as I can.

Solution #1

We just recently used the ‘cpuinfo‘ file to learn about your CPU. So, we’ll start with that one first. We’ll process it with ‘grep’ and then do some counting:

It might look something like this:

output showing there are 8 CPUs available
You’ll have to use your imagination for the rest. I’m only making one screenshot.

Now, those are individual threads that it’s counting – on the same physical CPU. But, to the system they appear to be individual CPUs. I can assure you, I do not have 8 physical CPUs in my laptop.

Solution #2:

Now, your computer does technically know if it’s a physical CPU, CPU core, or CPU core thread. It just normally doesn’t much care. If your CPU and OEM vendor did things properly, you can learn that information using ‘dmidecode‘.

They do not always implement this properly and you will sometimes find mistakes when using ‘dmidecode‘. Let’s hope for the best when we run this more convoluted command:

That one uses egrep and picks out multiple words to include. If you run that command, you should find out that your computer really can tell the difference between cores and threads – and physical CPU count (though not with this command).

Solution #3:

This final solution is nice and easy. If you’re gonna memorize one of these, this would be the one to memorize. In fact, if you’re going to need to count CPU processors or cores, you might just as well use this one. It’s easy and effective.

That one will output the total number of CPUs, cores, or threads. That’s all it will output, just a single number. That number is how many CPUs (effectively) your computer sees – and that’s it. It’s pretty much perfect.

Closure:

There you go. You have another article, this one explaining how to count CPU processors or cores (or threads, really). It’s handy information to know, though you probably already know it. Like I mentioned above, you can optimize C/C++ code to run on the specific number of cores – and there are other reasons you might want to know 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.

One Way To See CPU Information

Today, we’re going to explore one way to see CPU information. On the original site, I had a couple of articles about this sort of stuff but we didn’t cover this method. It’s a short and sweet process, though I’ll show you a couple of ways to process the output.

The date that this will be published is July 4th. That’s a holiday in the United States. Not only do I live here, the vast majority of my readers live here (according to the stats I have). So, this will be a nice and easy article. For those of you who reside elsewhere, you’re welcome. You won’t have to work too hard today to understand what’s going on.

Anyhow, we’re not going to use any special tools. We’re not going to use any applications that you don’t already have installed. While we likely could, there really isn’t any need to. This being Linux, the information we’re after is already in a file. All we need to do is read that file.

So, let’s get to it…

How To See CPU Information:

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 now open, let’s go ahead and read the file we need if we want to see the CPU information:

That’ll output a ton of text. You can read it as it is, or you can actually get it in a more readable form using the ‘less’ command. To do that, you just change out the ‘cat’ command, like so:

Now, just use the arrows on your keyboard to scroll down (or back up) through the text. When you want to close the output and return to the terminal, just press Q and it will close.

Closure:

That’s it. That’s all there is to this article that tells you how to see CPU information. It’s not a very tough article, and it’s quick. So, I met those goals! Yay me! Enjoy your holiday, even if the holiday is just a nice quick article that doesn’t require much thinking. Me? I’ll drink some beer and char some dead animal flesh.

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.

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.