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.

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.

Make Passwords In The Linux Terminal

Today’s article should be fairly simple and is about something we all use because it’s about how to make passwords in the Linux terminal. Assuming my writing chops are up for it, this article should be easy for everyone to follow. I’ll do my best. It might not even be a very long article.

I don’t think I need to explain passwords to any modern computer user. Even mobile users use passwords. The rare people who don’t use this technology will likely still use a PIN for things like their ATMs and credit cards. A PIN is just a numeric password.

I think it’s safe to say that we all know what a password is and why we use one. I’m not sure we all understand how to create good passwords, but we all use them. Perhaps this xkcd comic will amuse you:

xkcd's thoughts on passwords
Hopefully, this works as a hotlink, per xkcd’s request. I also can’t resize it. Ah well…

I have written about passwords in the past. One of the first articles on this site was about generating complex passwords. Here’s a link:

How To: Generate Sufficiently Complex Passwords In The Terminal

There isn’t much to add about passwords. It’s safe to assume we’re on the same page and that we’ve all used many passwords in our lives. I guess it’s then time to move along to the software we’ll be using to generate passwords in the Linux terminal.

Installing makepasswd:

In a previous article, we made complex passwords (with some degree of randomness) in the Linux terminal with a tool known as ‘pwgen’. You’ll find that pwgen is perfectly adequate and does a fine job at creating unique passwords in the terminal.

This time around, as we accomplish the very same task, we’ll be using a tool known as makepasswd. When you install makepasswd you’ll see that it has some small dependencies involving encryption and randomness. That makes some sense when you see how makepasswd is described on the man page.

makepasswd – generate and/or encrypt passwords

We’ll be doing that first bit – that is generating passwords.

You will need an open terminal to follow along in this next section. You can also use your graphical software installer, assuming you have one. To open your terminal, you can usually just press CTRL + ALT + T

With your terminal now open, choose the right command for your distro:

Debian/Ubuntu/etc:

OpenSUSE/SUSE/etc:

Arch/Manjaro/etc:

RHEL/CentOS/etc:

You’ll find that makepasswd is available for other distros, but I’m not sure of the installation commands and don’t want to steer you wrong. As it stands, I’m pulling these from my notes and haven’t tested them to ensure the commands are current. If they’re not current, please leave a comment so that I can update them accordingly.

Now that you have makepasswd installed…

Make Passwords In The Linux Terminal:

If you used a GUI tool to install makepasswd, or if you closed the terminal after installing makepasswd, you’ll need to open a terminal. Fortunately, I told you how to do that in the previous section. If you want to use makepasswd to make passwords in the Linux terminal, you will of course need an open Linux terminal.

With the terminal now open, you can check the man page for more information about the makepasswd application. That’s done like so:

The application is pretty simple, at least for our needs. If you just want to generate a password that’s 12 characters long, you’d run this command:

An example output might be something like this:

If you want to use certain characters, you can use the --string flag. So, if you wanted to generate a 12 character password with just numbers, you’d use a command that looks like this:

An example output might be something like this:

So, I suppose, you could even use this as a tool to generate a pseudorandom PIN for your debit card. 

If you want to generate a list of passwords so that you can pick the one you like from the list, you can do that as well. That command would look a little bit like the following command:

For some reason, it seems to only want to output a maximum number of characters in that command and the maximum number is 10. Do not ask me why, but the option is there and the output of that command might look a bit like this:

You can do quite a bit more with the makepasswd application. As mentioned above, check the man page. You can seed your passwords, you can encrypt them, get the hashed password value, and more. You could even take the above command and output it to a text file called passwords.txt. You’d do that like this:

As you can see in that command, I’ve included the --maxchars flag. You can set both the minimum number of characters and the maximum number of characters with the two flags used in the above two commands.

See? You’ll find makepasswd to be a handy way to make passwords in the Linux terminal. There are all sorts of ways to do this. This is just one more way.

Closure:

I wasn’t sure what I’d write when I sat down to write this article. I started it much earlier in the day than I usually would and flipped through all sorts of text files to find an interesting article to write. The first two articles that piqued my writer’s interest were topics I’d previously covered. I eventually settled on makepasswd. After all, you never know when you will want to make passwords in the Linux terminal. It could 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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Let’s Make A Linux Installation Drive

Today’s article might seem like a duplicate article, but it’s just another way that you can make a Linux installation drive. Today, we’ll be showing you yet another way to accomplish your goals. Why? Because we can! Because Linux has umpteen different ways to reach your goals – and that is awesome.

We’ll also be using a different tool for this exercise. It’s a pretty handy tool, suitable for more than just making an installation drive. Specifically, a USB thumbdrive! But, that’s just one thing you can do with this tool. It’s my way of introducing you to the tool in a useful manner. 

So, what tool will be using?

Introduction To ddrescue:​

The tool we’ll be using is called ddrescue and it’s a pretty handy tool. You probably won’t find ddrescue pre-installed, so you’ll almost certainly need to install it yourself. 

Also, if you want some confusion, if you’re using Debian, Ubuntu, Mint, etc., you’ll find it’s gddrescue at least during the installation process. Why? I don’t know. You’ll have to find out from the Turks.

Once you do have ddrescue installed, you’ll find the man page (man ddrescue) describes the application like this:

That’s right, it’s a data recovery tool! We won’t be doing any of that, however. You can probably install ddrescueview and do some of that good old data recovery with a handy GUI. I’m telling you, check the man page. This article is just going to scratch the surface.

Let’s Install ddrescue:

Yes, you can open up some GUI, type in an application name, and then install ddrescue. Or, you can open the terminal and install ddrescue without any GUI help at all. Let’s do that! Press CTRL + ALT + T to (hopefully) open up your terminal.

With your terminal now open, use the appropriate following command to start the installation process:

Debian/Ubuntu/etc:

Fedora/CentOS/etc:

Arch/Manjaro/etc:

If you don’t use any of those package managers, you may still have ddrescue in your default repositories. I just can’t confirm that you do.

Now, with ddrescue installed (even if you had to call it gddrescue during the installation phase), we can get into the meat of the article!

Make A Linux Installation Drive:

Remember that terminal that you opened to install ddrescue? Well, I hope you left it open because you’re going to need it. While the ddrescueview tool is a graphical tool, that won’t help with what we’re doing. We’ll be using the tool to make a Linux installation drive, which is almost an afterthought for this tool.

First, like a previous article about making a Linux install USB, we need to identify your target device. Plug in  your USB thumbdrive and use the following command to identify it:

You should be able to easily pick out your USB device by size. It will begin with an ‘sd’ (remember that it’s case-sensitive) and then may be broken down into partitions. Ignore the partitions and know that you’ll be removing any information on that USB drive.

You’re looking for something like sdb or sdc and you’ll add a ‘dev‘ in front of it. So, if your thumbdrive is sdb, your path is /dev/sdb. If your thumbdrive is located as sdc, the path you want is /dev/sdc. It’s pretty simple.

The syntax is as follows:

For example, this would be a command I could use:

This would let me write today’s current Lubuntu testing .iso to a USB drive so that I can test it on a laptop without having to waste the bandwidth to download the same file twice. 

Pretty handy, huh? 

Well, there’s a lot more you can do with ddrescue. I highly recommend reading the man page to learn more about this nifty application. It can do quite a bit more than this. Indeed, this is more an afterthought than anything else, or so it seems.

Closure:

Well, there you go. You have a new article. That happens regularly around here! Today we talked about yet another way to make a Linux installation drive. Frankly, you can just use balenaEtcher and call it a day. There’s no reason for most of us to do this in the terminal – but we can and it’s not even that difficult. You just need the right tools for the job and Linux has many tools on offer.

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