Another Way To Locate Files By Extension

I figure that today is a good day for a shorter article, so we’ll look at another way to locate files by extension. This is something that you can do in so many different ways. We’ll just cover another one, simply because we can.

You might want to locate files by extension when you’re doing file management tasks. When you have a directory containing many files, the output from the ls command can be pretty cluttered. For example, you might want only to list the files with a .txt extension. This article will help with that.

It should be noted that Linux doesn’t much care about file extensions. If you create a plain text file without any extension at all and add some text to the file, Linux will know that it’s a text file. See this article on Wikipedia about magic bytes:

List of file signatures

See also this article:

Magic Number on Wikipedia

About a year ago, I wrote a couple of articles on this same subject – that is finding files by extension. Of course, those articles are different than this article. This is a different way to locate files by extension. Those previous articles were:

Find Multiple Filenames By Extension – With Locate
How To: Find Multiple Filenames By Extension

So, finding files by their extension type has been covered before. We’re just going about it another way. The previous examples were a bit convoluted and this is just going to be an “easier” way. (I suspect that it’ll be easier. I guess that depends on what you consider to be easy!)

Locate Files By Extension:

Yes, we’ll be doing this in the terminal. I’m sure there’s a GUI way to do so, but that’s going to be a matter of the file manager you use. They will not all have the same features and not all of them will access those features in the same way. So, let’s get started by opening your terminal – just press CTRL + ALT + T and your default terminal should open.

With your terminal now open, we’ll use the find command again. You almost certainly won’t need to install anything but you can confirm that you have find installed with this command:

See? You have the find application installed already. 

If you check the man page (with man find), you’ll see find is described as:

find – search for files in a directory hierarchy

We’ll also be using grep and a pipe “ |” in this article. You should know that grep helps you sort stuff and that the pipe lets you take the output from one command and use it in another. The pipe is a very underrated tool by people who don’t know much about the terminal.

The command we’ll be using is a find command. The syntax is quite simple and would look something like this:

For example:

The -type f is telling the find command to only look for regular files. Then, the output from that command is then piped to the grep command. After that, the grep command looks for file names that contain a . and the specific extension you’re looking for. The output might look like this:

using find and grep to locate files by extension
This is a fairly new installation and most of my .iso files are stored on the network.

Now, this isn’t going to work if you just use wonky file names. This isn’t going to find files without that extension name. Remember, we’re trying to locate files by extension. We are not determining if the extension is correct and we are not determining what the file really is.

See? Pretty simple!

Closure:

Well, I said today’s article would be shorter. It’s also fairly simple. If you need to locate files by extension, there are many ways to do it. Some methods are easier than others. Perhaps some are more robust than other methods. Either way, you can now locate files by extension type. 

You might also be interested in this article:

Find Out What A File Is

Otherwise…

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.

Show Mounted Partitions

Today we’ll have a fairly easy article, one that won’t be too long, as we discuss a couple of ways to show mounted partitions. This isn’t anything complicated. A new user should be able to follow along, so long as they’re not too afraid of the terminal.

Even if a new user was afraid of the terminal, none of these commands perform actions other than providing information. If you are careful, even using copy and paste, you won’t risk harming anything. Then again, this is pretty basic stuff. You can handle it just fine! (I have faith!)

Did you notice how I said “a couple of ways”? Well, I said that because there are all sorts of ways to show mounted partitions. 

If you don’t know what a partition is, it’s pretty easy to understand. You have a storage drive. By itself, it’s pretty useless. You have to decide on a filesystem and add at least one partition for that storage drive to be useful. There are also virtual partitions that are created by, and used by, the operating system.

Additionally, that partition must be mounted to be accessible for normal read and write operations. Sometimes, you may need to unmount a drive to perform certain operations. For example, you can’t change the size of the partitions on a mounted drive.

All we will be doing in this article is showing the mounted partitions. I haven’t just picked two commands, I’ve picked the two commands that I think have the most easily processed output.

Show Mounted Partitions:

The very first paragraph mentioned the terminal. That’s because we’ll be using the terminal for these exercises. So, go ahead and press CTRL + ALT + T. Hopefully, that will open your terminal.

We shouldn’t need to install any new software for the tasks covered in this article. We will be using two different applications, but those are going to be installed by default more often than not. I told you that this one will be easy!

Show Mounted Partitions With The ‘df’ Command:

With your terminal open, you can start by verifying that the df command is installed on your system. You’d do that with this command:

With that information, you’ll not only get the version you’ll see why it’s probably installed by default. The df command is a part of ‘GNU coreutils’, which is a set of GNU-provided applications that should be installed by default.

When you check the man page, you can also that df is described as being:

df – report file system disk space usage

So, that’s probably a pretty good tool for showing your mounted partitions. The df command we’re going to use is quite simple. It looks like this:

You can check the man page to see what those flags are doing:

The command output is nice and easy to understand, but very thorough. The next command we’ll use only shows a subset of the above-mentioned virtual partitions. 

Anyhow, that command may look a bit like this:

using the df command to show mounted partitions
Yes, a lot of that is information you don’t really need to know – but now you do.

As you can see, the output from this df command is very thorough. You almost certainly won’t need that much information. Fortunately, the next command is more concise and will net you about all the information you might need in your day-to-day computing.

Show Mounted Partitions With The ‘findmnt’ Command:

This too is done in the terminal and is another way to do much of what you did in the previous section. You probably don’t have to install anything. The findmnt application is a part of ‘util-linux’ and will also be installed by default.

You can find out if the findmnt command is available with this command:

As you’ll see, is indeed part of the util-linux applications. You might as well check the man page, seeing as we’re already here. To check the findmnt man page, you’d use this command:

While you’re checking the man page, check to see how findmnt describes itself. It’s described like:

findmnt – find a filesystem

If you recall the introduction, I mentioned how you’d need a filesystem to make a partition useful. Findmnt appears to be a pretty good application for those who want to show mounted partitions.

You can run the command and get a cascade of data, much like the df command. Run this command:

But, you can run this command with a -D flag and get a subset of that partition information and this subset of information is probably all you’re going to need regularly. That command looks like this:

The more concise output from that command looks something like this:

showing mounted partitions with the findmnt command
Realistically, this is all the information you’ll likely need when you show mounted partitions.

(It was kind of broken for a while, but I fixed it so that you can click on the images and have them enlarge properly. The bug was a devious bugger, but I think I’ve nailed it.)

The output from that findmnt command is easy to read and doesn’t contain nearly as many of the virtually mounted partitions. It still contains some and I’m not sure why or what the difference is. You can see that both commands spit out slightly different bits of information – but the essential bits are there and, thankfully, they match one another.

See? I told you that it’d be easy!

Closure:

Well, at some point you may want to show mounted partitions. It’s handy information to have when you want to perform some disk operations. It can also be handy to ensure a drive is mounted properly.

There are all sorts of reasons why you might want this information. Then again, there are also a zillion ways to get this information (such as running the sudo fdisk -l command). I’ve just picked a couple of ways, though I had a preference for outputs that are easiest to read. 

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.

Disable A PPA The Hard Way

Today’s article is just for fun, as there’s usually a handy graphical way because we’ll be discussing how to disable a PPA the hard way. This is mostly an exercise in fun and education. It’s something you can do, but you do not need to do. We’ll be learning how to disable a PPA the hard way, specifically through the terminal.

If you’re interested in doing things the hard way, read on! We’ll have fun with this one, and having fun is essential.

There’s an easy way to manage your PPAs, and this is not that. In your application menu, look for ‘Software Sources’ and do that. Do not do this – unless you have no graphical environment.

A PPA is something used by Ubuntu, but is also used in Mint and is possible to use in others – like Debian which strongly suggests against it. PPA stands for Personal Package Archive and is meant to be exactly that. It’s us that abuse the idea, which is kind of how we ended up with Ubuntu Snaps and other similar package formats.

We use PPAs for all sorts of things, like adding entire other repositories to install custom software. It’s meant to be your personal package archive – meaning personal. We’ve decided it’s a fine way to add repositories to install software not included by default. Oops!

So, we’re going to disable a PPA, and we’re going to do it the hard way. We have no reason to do it this way, at least on desktop Linux, but we can. And so, just because we can, we have this article.

Disable A PPA The Hard Way:

Yeah, we’re doing this the hard way. So, that means we’re going to need an open terminal. If you don’t know how to open a terminal, you probably shouldn’t be doing this. But, just in case, you can normally press CTRL + ALT + T and your default terminal will open. Otherwise, you can open the terminal from your application menu.

With your terminal open, you need to first know what repositories you have available to you. You need to know the added PPAs. That’s easy enough, just enter the following commands:

That will change you to the correct directory. We’ll now list the files like this:

That will show you an output similar to this:

Find the PPA you want to remove. In our case, we’ll use teamviewer.list as the PPA (or ‘regular’ repository) we wish to remove. This works for both PPAs from LaunchPad or other repositories you may have added.

So, you’ll want to use Nano for this. Odds are that Nano is installed by default these days, but this is not always true. So, read the following page before moving on.

Let’s Install Nano (With Some Bonus Information)

So, we want to edit the teamviewer.list to disable the TeamViewer repository. That’s done with Nano and the command looks like this:

You’ll then be faced with a text file. Look for the line that starts with deb and is not commented out, that is not starting with a #  symbol. For example:

Find the correct line to edit when trying to remove a PPA.
This should be fairly easy for anyone to follow. It’ll be the line without the pound sign.

So, in my case, I’d take the line that looks like this:

And I’d comment out that line. More specifically, I’d add a # sign at the front of that line. So, it’d look like this:

You’ll then need to tell Nano to save the file. That’s easily done. You can just press CTRL + X, then Y, and then ENTER to save a file with Nano.

Next, you do this for any repositories (not just PPAs) that you wish to remove. Be aware that the software installed from those repositories will no longer update (which can be a bad thing). If you remove a PPA and still have the software installed, it should be temporary so that you can troubleshoot something.

Otherwise, you can now verify this. You simply need to update the available software again. You do that with this command:

When you do that, you should find that you no longer have that PPA (or just regular ol’ repository) enabled. It will no longer update, thus no longer offer you new versions of that software.

The latter part of that previous paragraph should be considered essential.

So, choose carefully. If the repository has software that you plan on using, you should probably keep updating it. Many of the updates aren’t just bug fixes. Oftentimes, they’re legitimate security fixes. Software is software, regardless of the operating system. It has bugs and sometimes those bugs are security issues. It’s best to keep your system updated and doing so makes you a good Netizen.

Closure:

So, yeah… We’ve discussed how to disable a PPA the hard way. You can disable any repository this way, I suppose. I’m not sure that I’d suggest doing it this way – unless you need to do it this way. If that’s the case, you should do it this way. Most of the time, there are nice handy graphical tools to manage that sort of stuff.

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.

Show Two Text Files Side By Side

Today’s article will be fairly simple, and easy enough for anyone to follow, as we talk about how to show two text files side by side. This is an immensely useful tool for editing text files. It’s a simple enough process and you probably won’t even have to install anything.

We all know what a text file is. I want to assume we can all see the value in comparing two text files side by side. If you want to compare and contrast text files, comparing them side by side is a pretty good way to do so visually. (Some tools will let you check the differences between files and I’ll likely do an article on some of those tools.)

We really don’t need anything special for this, but you can download the following file to your ~/Documents directory and we’ll all be on the same page – hopefully.

First, download this file:

sort.txt

Next, download this file:

sort1.txt

Don’t worry. Those are identical files with the original created for another exercise. We’ll use them both this time around, just as the example, so download them both to your ~/Documents directory.

The tool we’ll be using is the pr command.

The pr Command:

This pr application is part of the core utilities, so pr should be installed by default. You can ensure that pr is installed by running the following command:

The output of that will also let you know that it’s a part of the core utilities, specifically with this text (the version number may vary):

pr (GNU coreutils) 8.32

Like always, you should probably check the man page to learn more about the application we’ll be using. To do so, it’s simply:

If you check the man page, you’ll see that pr is described as this:

pr – convert text files for printing

You’ll also see that there are a whole lot of options. For a new user, this will seem confusing and complex. Don’t worry, we’ll only be worried about a couple of the options (flags in the command) and it’ll be quite simple.

Now, the following is going to assume you’ve downloaded the sort files from above. I’ll include generic commands as well. I just want to keep this article relatively short.

Show Two Text Files Side By Side:

You will of course need an open terminal for this. That’s easily done and on most distros you can just press CTRL + ALT + T and your default terminal will open. If that’s not the case, you can find and open the terminal from your application menu.

With your terminal open, and assuming you downloaded the files to your ~/Documents directory, you’ll want to first change to that directory. So, that command would be this:

You should probably run the ls command to ensure that you see both sort.txt and sort1.txt. Assuming you see both files, the command you’re going to want to use would be something like this:

So, in our case, the command you want to run would be this:

A quick examination will show that the two files are indeed open and that they’re identical in every way. You’ve now been able to show two text files side by side – and you didn’t even need to install any applications to do so.

Of course, the pr command has a lot more to it. You can do a great deal with this command besides using it to show two text files side by side. If you want to manipulate text, it’s one of many tools. This particular tool is usually used for preparing text for print, but it can be used in this way easily enough.

Closure:

I figured I’d keep this article nice and short. There’s no need to make it more wordy than required to get the point across. After all, it should be a simple task for people who do want to show two text files side by side. If it’s not simple, many folks won’t bother doing it. That’s one of the reasons why I try to keep some articles (including this one) simple enough to follow along. It’s great to expose people, especially new people, to new tools.

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.

Benchmark Your GPU In Lubuntu

Today we have a simple enough article, meant for fun and information, as we talk about how to benchmark your GPU in Lubuntu. This won’t be a very long and complicated article. Even a new user should be able to follow along.

We all like to know where we stand in life. This is true even with computers. At the very least, we want to know that our computer can accomplish the tasks we need it to accomplish. One of the ways you can do this is to benchmark your computer.

I’ve previously written a couple of articles that involve benchmarking.

Benchmark Your Linux Box With Geekbench 5
Check Disk Speed In The Terminal
Graphically Examine Hardware Info With HardInfo

So, this isn’t a foreign concept to my regular readers (whom I appreciate a great deal).

A benchmark pushes your hardware to the limits and then gives you a score telling you how well it did. Usually, the next step will be using your search engine to find out how well you did against other computers. (Those with older and slow computers may not do this, but I did with a recently purchased refurbished device, and it did not do well – but it still perfectly satisfies my needs.)

Your GPU obviously controls your graphics. I do not need massive graphic capabilities. I’m content with onboard graphics and my benchmark score shows this. At most, I’m going to stream a video, watch a movie, or play a game that doesn’t require high-end graphics.

You should know about Lubuntu already. The directions for this article are for Lubuntu, but will likely work with most other distros. For this exercise, we’ll be using glmark2.

Installing glmark2:

The first step to using glmark2 is opening your terminal. To open your terminal, CTRL + ALT + T. Then, with your terminal now open, enter the following command to ensure your system’s application database is up to date:

Let that run its course and don’t worry about upgrading at this point. You can always do that later, though I’d suggest doing so as soon as realistically possible because updates tend to contain security updates and those are important.

The next goal is to install glmark2 and you do that with this command:

If you’re not using Lubuntu and you’re using a distro with Wayland, then you want a different command. That command might be something like this:

With glmark2 now installed, it would be worth your time to check the man page. This article will only cover the very basic command, literally running the command without any flags, but there are many options available for you. To check the man page, use this command:

As you can see, there are quite a few options available. I will not be doing a deep dive into those options. You can easily figure most of them out on your own. Heck, you can probably figure them all out with a little trial and error.

Now that you have the GPU benchmarking tool, glmark2, installed in Lubuntu you can run the command in the terminal…

Benchmark Your GPU In Lubuntu:

If you’ve installed glmark2 and checked the man page, you’ll see that we’ve chosen the right tool for the job. The man page describes glmark2 as:

glmark2 – OpenGL (ES) 2.0 benchmark suite

So, assuming you’ve kept your terminal open (if not, open it again) then you need to simply use the command’s name to run a benchmark on your system. It’s that simple to benchmark your GPU in Lubuntu. Just try this command:

In theory, you should not do anything with your computer while this runs. I, of course, did not listen to that advice and I’m perfectly okay with that. As I mentioned above, my graphical needs are not high. The Intel graphics are just fine for me.

That’s going to take a while, especially on an older computer like mine – and one with just an onboard GPU. This should open a new window and display a bunch of graphics in that window. If you didn’t do this in full-screen mode, that is without any flags to set that value, you’ll also be able to see quite a lot of information scrolling by in your terminal. Someone smarter than I am can tell you what that information means.

Wait for the benchmark to end, that’s when the new window closes, and collect your score from the terminal. Mine was not very high.

Then, use your favorite search engine to see how well you did compared to other users. If you want to compare your score against other computers, you can try this OpenBenchmarking link. I’m sure there are other sites where you can compare your score with others. That’s just the one I happened to find in a very brief search.

Closure:

So, I don’t know if you actually want to benchmark your GPU in Lubuntu. If you do, now you know how. It’s not terribly complicated and it is something you can do in just a few short minutes.

You’re not supposed to use your computer at the same time, but I had dozens of windows open and was streaming a video during my benchmark. In my case, it doesn’t matter to me. I have no need for more powerful graphics and I’m content with the performance I get from this device. It’s perfectly capable of meeting my needs.

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.

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.