How To: Find Your CPU Information

Today’s article shouldn’t be all that long, as it’s a subject touched on before, as we discuss how to find your CPU information. This will be in the terminal, of course. There are also many ways to find your CPU information. This article will just cover another way that I don’t think we’ve already covered.

I’ve touched on this subject before:

One Way To See CPU Information

In that article, we simply used the ‘cat’ command to read information from a text file. It’s a pretty handy way to find CPU information, but it is not the only way.

You can also get some basic information about your CPU with Screenfetch or Neofetch. I’ve written about those as well:

Screenfetch vs. Neofetch, You Decide!

I’ve even covered ‘lscpu’ in the past. You can read that article here:

A Little About The ‘lscpu’ Command

So, as you can see, there are lots of ways to find out what CPU you’re working with. You can do it graphically, that is in a GUI, if you’d rather. It’s as simple as installing an application called ‘HardInfo’ and you can read more about it here:

Graphically Examine Hardware Info With HardInfo

See? There are all sorts of ways to get information about your CPU. You have all sorts of choices and this article is going to simply detail yet another way to gather this information.

Why? Well, I like to be the kind of person that gives you options. I like that there are so many ways to accomplish a task in Linux.

Why would you want this information? Perhaps you bought a new computer. Then again, you might have paid for a server (virtual or real) and want to confirm that you’re getting what you paid for. You could have multiple devices, such as myself, and not remember what hardware is in each of those devices. 

There are all sorts of reasons why you might want to know your CPU information. There are all sorts of ways to get this information. Today can have a shorter article than we’ve had lately, as we cover this topic yet again.

Find Your CPU Information:

As mentioned in the opening of this article, we’ll be doing this in the terminal. My regular readers will be used to this and will know how to open the terminal. If you don’t know how to open the terminal, you can almost always just press CTRL + ALT + T, and your default terminal will open up. You may otherwise need to open a terminal from your application menu.

With your terminal open, we’ll be using the ‘lshw’ command. You shouldn’t need to install anything. The ‘lshw’ should come pre-installed as it’s a rather basic piece of the common Linux toolbox. If you check the man page (with man lshw), you’ll see that the program is just like many of the other ‘ls* applications, in that it lists hardware. Specifically, it says this:

lshw – list hardware

That’s an accurate enough short description. The actual description says this:

lshw is a small tool to extract detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc. on DMI-capable x86 or IA-64 systems and on some PowerPC machines (PowerMac G4 is known to work).

So, the lshw tool is a pretty good tool to have handy when you’re wanting to know information about your hardware. I once botched an article on lshw! I’m sure I’ll botch another one eventually!

Specifically, you simply want to use the command as follows:

You want to run the lshw command with sudo (or as root, if sudo is not available) so that you have the elevated permissions to retrieve full information in the command’s output. If you try to run lshw without elevated permissions, it will remind you that you should do so.

On the man page, you will discover a bug. I’ve yet to see this bug in real life, but there is a bug. The man page explains it like this:

Not all architectures supported by GNU/Linux are fully supported (e.g. CPU detection).

So, that’s something to be aware of. I doubt it’s going to impact (m)any of my readers because we’re almost always using fairly common CPUs. It should correctly identify your CPU.

Closure:

Well, it’s a pretty basic subject and an easy enough command to keep in mind. If you want to find your CPU information, there are a ton of ways to do so and we’ve just covered one more way. This seemed like an easy article to write and I could use an easy day. I think we could all use an easy day once in a while, but the show must go on and you get yet another article for your enjoyment.

I have been making the articles longer. I’m trying to share more information along with the directions. I think it’s good for understanding and it doesn’t take that much more time. If you have an opinion on the matter, please leave a comment.

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.

Install A .deb Package In The Terminal

Today’s article is a basic article where we discuss how you can install a .deb package in the terminal. It isn’t all that complicated and there is almost always more than one way to accomplish things, especially when it comes to the terminal. If you want to install a .deb package in the terminal, this article is for you.

Obviously, this article only applies to distros that use the aptitude package manager, or ‘apt’ for short. These are generally the Debian-based distros. You’ll find that apt is used in Debian, Ubuntu, Linux Mint, ElementaryOS, and many more. It’s a pretty common theme among the more commonly mentioned desktop distros.

If you type man apt into the terminal, we get the following:

apt – command-line interface

That’s not very helpful, but it does give us some clues. It’s a command-line interface (often called “CLI”) for the package management system. If we read the man page a little further, it goes into more detail.

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

See? That’s a bit more helpful. When you’re reading the man page for an application, it’s a good idea to read the description portion of the man page. It explains a great deal, more often than not.

We will also be using ‘dpkg’ in this article. The man page (accessed with man dpkg) describes it accurately enough:

dpkg – package manager for Debian

Where apt is a “high-level” application, the ‘dpkg’ application is considered a “medium-level” application. The ‘dpkg’ application may be used by a higher-level application, providing a more stable command set and being used behind the scenes.

As a previous article about installing .deb files didn’t mention it, I figured it’d be worth an article of its own. I’ll still include installing software with apt, just so the folks arriving by search engine needn’t view multiple articles.

If you don’t already know, “.deb” files are packages for installing software. They adhere to the standard and are standard ar formatted archives. They’re meant to be used for installing software on your system, especially when you don’t have that software in your repositories. They often contain changes to system configurations and do the aforementioned software installations, so you need elevated permissions to run them.

If you’re curious about what’s inside, I wrote an article about that.

Extract Files From .DEB Files

For most users, they’re not all that interesting on the inside. You can extract them (even graphically) to see what’s on the inside. You can also use the extracted files if you can find a use for them.

So, today we’re going to learn how to extract a deb package from the terminal. We’ll cover a couple of different ways. If you want to do this graphically, you can do that. I’ve written another article about installing .deb files (not quite like this one) and the second section covers doing this graphically.

How To: Install .DEB Files In Ubuntu

With all that said, and hopefully understood, let’s get to it!

Install A .deb Package In The Terminal:

As the title implies, this is installing .deb packages in the terminal. To do this, you’ll need an open terminal. If you don’t know how to open a terminal, you may wish to learn. A terminal is a handy tool and you can usually open it by pressing CTRL + ALT + T.

With your terminal open, the absolute easiest way to install a .deb package in the terminal is to use that apt command mentioned earlier. It’s very simple:

Frankly, that’s probably the best choice. Using the higher level apt means that any dependencies will be sorted – if they can be sorted. If they’re not able to be sorted by downloading them from the default repositories, the application will fail gracefully and throw an error message. At that point, you can try to resolve the dependencies on your own, but that can be a pain in the butt.

Note the use of a full path. If you use apt, you must supply a path – something like ./foo.deb, ~/Downloads/foo.deb, or even /home/Downloads/foo.deb. Without a path, apt will not find the .deb file.

Anyhow, you can also install a .deb package in the terminal with the dpkg tool. It’s possibly a bit more complicated, but the syntax is as follows:

This is often adequate, but not always. The limitation is that the dpgk command doesn’t automatically resolve dependencies. It is because of this that I seldom recommend using dpkg and prefer to suggest using apt.

Never fear, this is still not lost. You can trivially resolve the dependencies (if they can trivially be resolved) with the following command:

That command will go through your installed software and try to fix (-f) any missing dependencies. If there are no dependencies needed, you do not have to run this command after installing packages with dpkg. 

Though, as you can see, it still relies on using apt. My thinking is that you can save all that hassle by just using apt in the first place. But, it’s your system. You have options when you want to install a .deb file in the terminal. It’s worth the article just to let folks know.

Some folks still recommend installing with dpkg and then running the apt command to resolve dependencies. I do not know why. If you have any good ideas about why, do feel free to let me know in a comment.

Closure:

Well, there you have it. You have yet another article, and yes it’s another one that relies on using the terminal. There are GUI tools that happily take care of all of this for you.

There’s no need to use the terminal to install software, but I prefer it. It’s just as quick for me to type out a command as it is for me to open software, type my password, and then click a button or two. It’s probably faster for me, as I always have a terminal open.

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.

Add User To The ‘sudoers’ Group

Today we’ll have a pretty straightforward article that’s meant for those who want to add a user to the ‘sudoers’ group. I have tested this in Ubuntu, specifically in Lubuntu, and it works. It shouldn’t be a complicated article, one easy enough for anyone to follow.

I am not 100% certain if this will work in other distros, so comment and let me know if it works with others. It should work in Debian, the official Ubuntu flavors, Mint, POP!_OS, ElementaryOS, and more. That much I’m pretty confident of, but I’ve done limited testing.

This article is going to assume you’re using ‘nano’ as your default text editor. That’s important for this, otherwise, you’ll need to change the directions to match your text editor of choice.

Let’s Install Nano (With Some Bonus Information)

We’ll be using a tool known as ‘visudo’. The man page defines it as:

visudo — edit the sudoers file

It’s important to use visudo to edit the sudoers file because it checks for errors and will prevent you from making syntax errors. It can’t correct bad information, but it can prevent you from making some basic mistakes.

What is the ‘sudoers’ file? 

Well, simply put, that’s the file that decides who has the rights to access sudo, and what rights they have to do so. A sudo user has administrative privileges, that is the ability to edit files that can’t be edited by a regular user. The sudo users can do things like change system files, change system settings, and add or remove software. They’re administrators (though you technically can give them limited rights, which is a topic for another article) so to speak.

So, What Is ‘sudo’ Anyhow?

You should make good choices when deciding which accounts have sudo access. They, at least by default, have the keys to the kingdom. A user with sudo access has complete control over the system. This isn’t always a good thing.

Many distros, including Ubuntu, use sudo instead of a root account. Root also has the keys to the kingdom. It’s a good way to view sudo as temporarily elevating the user’s rights to that of the root user. It should be obvious why this is beneficial.

Most of us don’t want our account to have root access all the time because it stops us from editing files we might not want to access – and the software we use also only has our regular user’s limited access to the system. Some folks are into running as root, and some distros have root enabled by default. The great thing about Linux is the choices available, including choices about security.

How To: Enable The Root Account in Ubuntu
How To: Graphically Login as Root in Ubuntu

(It’s generally suggested you not follow the directions given at those two URLs, but I’m a big fan of choice and of sharing information. So, you can do what you want. I do ask that you be careful and be a good netizen.)

That’s what we’ll be doing today. We’ll be learning how to add a user to the ‘sudoers’ group (file I suppose). Those user accounts will then have sudo access, the keys to the kingdom. There are a ton of valid reasons for doing this, and some not-so-good reasons. It’s your device. You do you!

Add A User To The ‘sudoers’ Group:

Yes, this article requires a terminal. I don’t know of a GUI way to accomplish this task. I’m sure there is one, but I don’t know. If you know of one, feel free to add a comment. Otherwise, press CTRL + ALT + T and your terminal should pop open.

With your terminal now open, you can easily just run the following command:

Of course, that’s the easy way…

If you want, you can manually edit the sudoers file. You’ll want to know how to do this if you only want to give the user elevated permissions to certain directories or files. So, I’ll include that. We can use this article as a reference article for a future article.

To manually edit the sudoers file,  you just run the following command:

You’ll then add the following line at the bottom of the file:

Replace the obvious with the obvious, as always. Be extra careful to avoid typographical errors. Then, you’ll save the file. As we’re using nano, the process to save the file is pressing CTRL + X, then Y, and then ENTER – and that should save the file. Congrats, you now know how to add a user to the ‘sudoers’ file.

Closure:

Well, it’s another article. As I mentioned, there are legitimate reasons to add a user to the sudoers file. There are also legitimate reasons for not doing so. It depends on you and your circumstances – and your computing goals are your own. This is Linux. We can do what we want!

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.

Dealing With “Could not get lock /var/lib/apt/lists/lock”

Today’s article is a rather specific article, where we examine a couple of ways to deal with the message “Could not get lock /var/lib/apt/lists/lock”. This is an error message that you’ll get when something is already updating (or installing) and you try to install something else or if you try to perform updates.

Basically, when you update something, apt will lock a file so that nothing can interfere with it. This is a good thing, ensuring your updates go smoothly. This is something you want to have to happen.

However…

Things don’t always go according to plan. Things may freeze, things may take too long, and things can stop the upgrade (or update, let’s use those words largely interchangeably). You may find yourself coming across this message and not knowing what to do.

A bit on update and upgrade

First, obviously, this article only applies to distros that use ‘apt’ as their package manager. So, that’s Debian, Ubuntu, Mint, and many more that are derived from Debian or Ubuntu.

You have on your computer a database of software available in the repositories you’ve enabled. Then you update this database software with ‘sudo apt update‘. You then upgrade your software when you run ‘sudo apt upgrade‘. So, in the very specific terminology used, there’s a difference between update and upgrade. I know this, but will use the words interchangeably. 

As mentioned, when you’ve started this process (that is the updating of the database) you’ll be frozen out of further apt commands that can act on the system. You can still run queries like ‘apt-cache search foo‘ but you can’t install or uninstall software while this process is happening. The same is true during the upgrade portion of the process.

Well, that’s when you’re going to get this error message.

For example, I recently had to update a Linux Mint system and the update process was horrible – but mostly because it didn’t seem designed to work with bandwidth like mine.

There were constant timeout warnings even though things were still downloading. Things would also freeze entirely and it was during this that I realized I should write an article about what to do when you get the message “Could not get lock /var/lib/apt/lists/lock”. After all, I was killing that process like an assassin in a video game. I showed no mercy!

NOTE: The correct thing to do is wait. If waiting doesn’t work and much time has passed, the next correct thing to do is reboot. After you’ve rebooted, you should try the update again and follow any directions it might give you.

YOU SHOULD NOT DO THIS!

I don’t always follow directions well. Nor do I always do the right thing. This is hardly the first time I’ve given you answers about how to do the “wrong” thing right. This probably won’t be the last time I’ve told you how to do things that are generally considered a bad idea, sometimes an especially bad idea.

With that said and done…

Fix “Could not get lock /var/lib/apt/lists/lock”:

You’re going to want an open terminal for this. Yes, a terminal. You should be used to that by now. The terminal is a handy application and we use it often. In most cases, you can just press CTRL + ALT + T and your terminal should open.

We want to get rid of the message “Could not get lock /var/lib/apt/lists/lock”. and I’ll cover a couple of quick and easy ways to do this, meaning you can (generally) start the process all over again. With your terminal, we’re going to find the PID – that is Process ID – and kill it.

You can read this article:

Find An Application’s Process ID (PID)

Or you can skip that article…

We already know that we’re interested in apt’s PID, so we just run this command:

Take the output from that and enter it in the following command:

Of course, that’s the fun way. You can actually use a much easier command to deal with the “Could not get lock /var/lib/apt/lists/lock” message. It’s not nearly as fun, but it should work every time. Try this command:

That one command should always work and is fairly easy to remember. You just take the path of the lock from the command, elevate your permissions, and remove the lock. It’s not unlike using lock cutters on a real-world lock, but requires much less physical effort!

Again, I highly suggest you resolve this message in the proper manner. Wait a while, reboot if nothing changes over time, and then try the update again so that you can follow any directions it gives you. That’s the smart way to deal with this.

Closure:

Yup… Here I am giving bad advice on the internet. I figure folks might just want to do this. If they want to do this, they might as well have good directions. This isn’t the correct way to deal with “Could not get lock /var/lib/apt/lists/lock” but it’s a way of doing so. You could end up with some currupt files and impropperly installed software, so you really should not do it this way, but it’s your 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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Update A Single Package In Ubuntu

Today’s article should be short because it’s late in the evening and I have decided to write about how to update a single package in Ubuntu. It’s an easy topic to write about, as there are really just a couple of choices. It shouldn’t be complicated and, for the most part.

First, let me state this…

I firmly believe that you should keep everything updated and updated the minute the update is available.

HOWEVER…

That assumes a perfect world. We do not live in a perfect world. We live in the real world. Because of this, people delay updates for various reasons. The biggest delay I can think of at this hour of the night is the delays added in the business world.

Rather than push an update to production, they’ll run it through testing first. It can take quite a while before an update makes it into production.

The reality is that many of our updates are security updates. As a byproduct of their update policy, at any given time they’re running insecure software. I understand why they’d do this. They don’t want things to break. They certainly don’t want public-facing things to break.

Again, I can understand why regular people follow a similar process. They’ll wait and watch to see if the updates cause problems for other people. But, that’s like waiting for the first person to jump in the river to see if the water is cold.

In all my years of using Linux, I’ve had updates bork the system fewer times than I have fingers on one hand. I’ve had updates bork the system so completely that it hoses everything exactly zero times. As in, not once was I screwed over by an update that really did any damage.

But…

Again, I can understand those who would rather be cautious.

This article is for you. It’s for you people who want to update a single package in Ubuntu. It’s for those people who do what they must in order to maintain a stable system.

This isn’t just applicable to Ubuntu. I tend to use Lubuntu and, as such, am a fan. So, I used Ubuntu in the headline. This applies equally to Debian, Mint, and other Ubuntu derivatives. It should even work in derivatives of derivatives. It’s pretty basic stuff.

Update A Single Package In Ubuntu:

So, you might be able to do this with a GUI. I don’t actually know and I didn’t test to see if there was a way to do so graphically. Check your software manager while the rest of us open a terminal. You can (more often than not) open your default terminal by pressing CTRL + ALT + T.

With your terminal now open, you need an application to update. If you’re a good netizen, you hopefully don’t have many upgrades available. You can check and see by running this command:

You can then get a list of applications that can be updated, assuming there’s an application that can be updated, with the following command:

The next step is to use one of the following two commands to update a single package in Ubuntu (neither of which are all that difficult):

Yes, that looks like it’s going to install a new application, but you substitute the <package_name> with the package name that you want to update in Ubuntu. The ‘install’ will happily upgrade to the next passage.

The next one is bit more jargony. Jargon-y? Maybe? It’s more complicated looking (but easy enough to memorize). So, if you want to update a single package in Ubuntu, this too should also do the trick:

Once again, you replace the obvious with the obvious. Just doing so would help you sort out how to update a single package in Ubuntu. Either of these commands should work, so you do have a choice.

Closure:

As I said, it’s not going to be all that difficult to update a single package in Ubuntu. You have a choice in commands. While I think it’s best to avoid all update delays, I do understand why you might want to be more cautious.

I go full blast at updates, but I’ve lately been a bit slow about major upgrades. In my case it’s a bandwidth issue. I had one box running like Linux Mint 20 or something like that…

Wait, it still says 21 is the version – but I’m quite literally nearing the end of the upgrade process. That may have already changed. I was so far behind that I needed more than 4 GB worth of downloads. When I’m done we’ll have an OS that’s missing almost all the stuff I installed on top of it! 

It can sure be a pain in the butt. Alas, as least I’m not trying to update a single package in Ubuntu!

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.