And Still Another Way To Find Files By Extension

Today we will cover a subject we’ve covered before, as we discuss yet another way to find files by extension. This is Linux! We have options! There are so many ways to find files by extension – and this is one of the more interesting of those ways. So, if you want to find files by extension, this might be the article for you.

You might be interested in previous articles that covered this topic:

Another Way To Locate Files By Extension
Yet Another Way To Find Files By Extension

You can search to find more. This is a task that has all sorts of ways to accomplish it. Some ways are easier than others. I’d say that the method we use to find files by extension in this article will be fairly easy. There’s not a whole lot to it.

We will be installing software. We’ll be installing mlocate but the man page will refer to it as plocate while the command we’ll be using will just be locate. Sound confusing? Well, it is. Don’t worry, the directions are still simple.

mlocate:

We’ll be installing mlocate as our tool to find files by extension. We’ll do this in the terminal, a fairly universal way to do things. Pretty much every distro is going to have at least one terminal available. You can usually open your default terminal by pressing CTRL + ALT + T on your keyboard.

When you do get mlocate installed, you can check the man page with ( man locate). There, you’ll see that locate is described like so:

plocate – find files by name, quickly

Yes, it has now been called mlocate, plocate, and locate. No, I do not know why. I do not think I’ll try to find out why. This is just one of those things you sort of accept and move on. Please feel free to research this and leave a comment. I’m not terribly curious, but other people might be.

With your terminal open, we can get mlocate installed with one of the following commands:

Debian/Ubuntu:

Arch/Manjaro/etc:

RHEL/CentOS/etc:

OpenSUSE/GeckoLinux/etc:

There are other package managers. If your package manager isn’t covered, just go ahead and search for “mlocate” and you’ll likely find that it’s available by default.

Configure mlocate:

Now that you have mlocate installed on your system, you need to update the database. The locate command requires a database. On slow systems with many files, this can take a few seconds. It should not take long on a modern system.

The only command you need to run at this stage is this:

Let that finish. It should not take very long. If it’s taking a long time, something might be amiss.

That’s all you have to do. The database will happily keep itself updated, though may take a short while to do so. If you add a new file, it might not be in the database immediately. In theory, this lag could mean you miss something – but the odds of that are rather low unless you’re constantly generating additional files.

I guess that means we should talk about using the locate command.

Find Files By Extension With The ‘locate’ Command:

As the title indicates, our goal is to find files by extension. We’ll be using the newly installed and updated locate database. The syntax is really simple. You’d just run a command like this:

For example,  you can find .iso files this way. That command would look like this:

That command will find everything with .iso in the name. If you have a foo.bar.isotext file that’s not really an .iso file, you’ll have to ignore that result because the locate command is going to find it.

But wait, there’s more!

You can limit the search to just a single directory. The command may not look conventional, but the syntax is as follows:

Let’s say that I want to find all the files ending with .iso in my ~/Downloads/ directory. That command would be simple. It’d look like this:

An example output might be something like this:

using the locate command to find files with a certain extension
It’s not hard to use the locate command to find files by extension. You’ve got this!

See? It’s not too hard to use the locate command. You can do more with the locate command, but this is just using it to find files by extension. Read the man page to learn more about it.

EDIT: Closed parentheses thanks to @Osprey.

Closure:

Well, this is a fairly short article. This time around, we just used a different method to find files by extension. There are lots of tools at your disposal and we use the locate command for this one. Just remember to update your database before you use it. Other than that, it’s pretty simple. It’s easy enough for new folks to use it!

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 More Current Version Of LibreOffice In Linux Mint

Today’s article won’t be too difficult for most readers as we install a more current version of LibreOffice in Linux Mint. This is something we do from inside the terminal, but I’ll include clear directions that are simple enough for anyone to follow. If you do have issues, you can always leave a comment.

In reality, this applies to any distro that can take advantage of PPAs (Personal Package Archives). You could even make distros that don’t support PPAs out of the box support PPAs, such as Debian or ElementaryOS.

In fact…

Enable PPAs In Elementary OS

You might also want to read:

How To: Add A PPA To Ubuntu

But, adding a PPA will just be one step in today’s article. There will be more to it and none of it will be technically challenging, so long as you can follow directions.

What Is LibreOffice?

As you’re using Linux Mint, your version of Linux came with LibreOffice already installed. You can think of LibreOffice as being an alternative to other office suites, such as the venerable Microsoft Office.

LibreOffice is a fork of OpenOffice that was made after Oracle acquired the rights to OpenOffice. I don’t have any statistics, but there’s a lot of evidence that would suggest LibreOffice is now the more popular of the two – at least in the Linux world.

If your distro has a full-blown office suite installed by default, it’s probably going to be LibreOffice. It’s because of this that I strongly suspect that LibreOffice is more popular than the original OpenOffice. There are other office suites available for Linux and all sorts of alternative applications for the applications contained in the LibreOffice suit.

You can read more about LibreOffice here:

LibreOffice Project Page

For the uninitiated, LibreOffice provides the following:

Writer: A word processor
Calc: A spreadsheet editor
Impress: A presentation app
Draw: A vector-drawing program
Base: A database program
Math: A math-formula editor

So, LibreOffice is pretty handy, with lots of tools available. Best of all, it’s free as in beer and liberty.

About Updating LibreOffice:

If you want a more current version of LibreOffice, it’s not all that taxing. Here’s why you might want a more updated version of LibreOffice:

This is the version currently installed in Linux Mint:

current version of LibreOffice installed in Linux Mint
There’s probably nothing wrong with using an older version of LibreOffice.

This is the current version of LibreOffice that’s available on their site:

this is the current version of LibreOffice that's available on the project page
This is the version you could have if you wanted to. If you want to…

So, you can have a newer version of LibreOffice because the PPA we’ll be using is meant to provide just that. The PPA provides you with a newer version of LibreOffice than what’s already installed. 

Do You Need This Updated LibreOffice:

No, no you probably don’t. Not only can this cause issues with the application’s stability, but it may also introduce new bugs. This comes with a caveat or two.

If you’re dealing with a show-stopping LibreOffice bug and it’s fixed in the more recent versions, that’s a good reason to move to the cutting-edge versions of LibreOffice. It’s also a good thing for those who are just curious about the latest features in LibreOffice. If you’re interested in helping out and reporting bugs, this too would be a good reason to go through this process.

When you add the PPA, there’s this warning:

Most of the packages in this PPA have only experienced minor testing — in fact it is the place to enable a wider audience to test packages before they are published into the distro proper. In general, this PPA is _not_ for the average user to install without a closer look (if it would be, its packages would be in the main repositories). OTOH, it is _way_ _better_ to use packages from this PPA than using the *.deb files that The Document Foundation provides upstream, which are intentionally build against a very old baseline for maximum compatibility. So, _if_ you want to be on the bleeding edge, do it here, not with upstream *.debs.

Read that carefully. Make sure that you understand the risks involved. Do not do this without realizing the potential consequences. This can break things. This almost certainly will break things.

Those things will be limited to LibreOffice. You don’t have to worry about it breaking your whole system. There’s little risk of that happening, so don’t worry about that. But, you will be using the latest and greatest versions of LibreOffice.

For the overwhelming majority of people, using the default version of LibreOffice in Linux Mint is going to be the path of least resistance. While this article does specify Linux Mint, this is also true for the other distros out there. If you ride the bleeding edge too long, you will get cut.

The Current Version Of LibreOffice In Linux Mint:

As I said way back at the start of this article, you’re going to need a terminal for this. Once you have that terminal open, the rest is pretty easy. You just need to commit to it. So, press CTRL + ALT + T to open your terminal and let’s get this show on the road.

First, we’re going to add the PPA. That’s easy.

That’s going to output a bunch of text. At the end of it, it will tell you what to do. Specifically, it will say Press Enter to continue or Ctrl+C to cancel and you’ll just press the ENTER button to continue adding the PPA to your list of repositories.

The next step is to update the database of software that’s available to install via your repositories, including the ones you’ve added manually like this one. That’s a command everyone should know by now.

Seeing as you’re there, and to ensure that you have the latest available packages installed before the next step, run this command:

Now, if there’s a newer package of LibreOffice in the default repositories, that command will also update that. However, that will not install the latest and greatest LibreOffice in Linux Mint. 

No, no… You have one more step to install the most up-to-date (available) version of LibreOffice in Linux Mint. To do that, just run the following command in that same terminal window.

That will get you the latest version of LibreOffice that’s currently available in the official LibreOffice repositories. It’s about as bleeding edge as you can get. It may not give you the absolute latest, as it sometimes takes a little while to add the new software to the repositories, but it’ll be a much newer version than the version that was installed by default.

Your result might look something like this:

The results of installing the most current version of LibreOffice on Linux Mint
There you have it, the latest available version of LibreOffice installed in Linux Mint.

Is this something you want to do? Do you need the latest and greatest version of LibreOffice? Are you ready to deal with the potential bugs and are you ready to help the community by reporting any bugs you find? If you’re just a curious sort of person, this might be something fun to try. Otherwise, you might just want to leave well enough alone and be happy with the version that has been tested and deemed ready for full release.

Closure:

Well, this article turned out longer than I expected it to. That’s okay. I’m sure you can handle it. It has pictures! That might help! Well, they probably won’t help but you only need the text. The pictures are just decorative and mildly informative. They’ll be out of date in less than a week.

You should give this serious consideration before you decide to do this. I’ll do an article in the future that will tell you how to undo this should you decide you want to back out of it. That’ll be a nice article and should be easy enough for anyone to follow. After all, if they made it this far they can probably make it the rest of the way.

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: Delete A Swapfile In Linux

Today’s article will be a bit more advanced than some as I try to explain how to delete a swapfile in Linux. If I do my job right, it’ll be easy enough for a newbie to follow. However, I’m not going to suggest newbies mess around with removing swapfiles – but they certainly can.

It should probably be noted that some folks will call this a “swapfile” and others will add a space to call it a “swap file”. I’m not sure which is correct, so I’m sticking with “swapfile” for consistency sake. After all, about two years ago, I wrote an article about how you can enable a swapfile.

How To: Create And Enable A Swapfile

This article might be a bit complicated. The directions themselves are pretty simple. Distilling the concept of ‘swap’ down to an 800-word article is the difficult part. 

What Is A Swapfile:

What is swap? Well, it’s not really a place where the kernel sticks stuff when there’s no more free RAM. People seem to think that’s what swap is, and it’s not. Even on systems with lots of RAM, the kernel will use swap when it is available.

It’s quite a bit more complicated than that, though it can sort of be related to that. It would be prudent to suggest that you read this thread first, concentrating on the first post in the thread:

To swap or not to swap, that is the question.

I’d further suggest reading this article from the folks at linux.com:

All about Linux swap space

There’s more to it than the article goes into, but pay attention to this bit of text quoted below:

Second, a significant number of the pages used by an application during its startup phase may only be used for initialization and then never used again. The system can swap out those pages and free the memory for other applications or even for the disk cache.

In the early years, we used a special partition for our swap. These days, there probably isn’t much need for a special partition. Most of us that still use swap will be using a swapfile. This is essentially the same thing, but it is a file instead of a special partition on your storage drive.

Your distro may have created a swapfile during the installation process. You may have created your swapfile along the way. Well, this article is going to tell you how to delete a swapfile, just in case you changed your mind.

Delete A Swapfile In Linux:

Yeah, this sort of thing pretty much requires using the terminal. I don’t know of a way to do this graphically, though there’s probably a way that I don’t know about. So, press CTRL + ALT + T to open your terminal and we’ll head straight into the article.

With your terminal now open, let’s first make sure that you have swap to begin with. To do that, you can run this command:

Technically, you don’t need the -m flag, but it’s easier to read in my opinion. The output might look something like this:

As you can see, the system has 16 GB of RAM and 2 GB of swapfile space. Of that 2 GB of swapfile, 737 MB is being used. There’s lots of free RAM, but swap is still being used. Like I said, it’s not just a place where the kernel stuffs things when there’s no more free RAM.

So, now that we’ve learned there’s a swapfile, you can run this command:

The output from that might look something like this:

The bit we’re looking for is /swapfile because that’s the literal name of the swapfile. You could have called it anything while setting it up, so it’s important to get the name correct for the next command.

Now, we want to delete your swapfile. That’s a very easy command. It looks like this command:

In my example, if I wanted to delete a swapfile on my system, the command would look exactly like this:

To confirm that the file is deleted and no longer being used, just run this command all over again:

It might seem a little complicated at first and I hope I explained it well. Using swap (or not) can be a complicated subject, but it’s not all that taxing to delete a swapfile in Linux. If you can follow the above directions, you should be good to go.

Closure:

As I’ve mentioned before, I leave swap enabled because the kernel uses it. The kernel uses swap even on systems with a lot of free RAM. I figure the kernel is smarter than I am, so I leave it enabled.

The second link in this article is well worth reading. Deciding to use swap or not is a very personal thing. If you have plenty of RAM, you can get away with not using any swap at all. Of course, if your system is fast enough and you’re using an SSD, having a swap isn’t going to add much latency to your system – if any at all.

This is something you get to decide. You can decide what is right for you and your computing needs. If you want a swapfile, you can easily add one. If you want to delete a swapfile that was created during the installation, you can do that as well. This is Linux and your configuration options are nearly endless. You decide what’s best for you. You decide how you run your Linux because it is your Linux. And that is awesome.

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.

Find Your Last Boot Time In Linux

It’s a weekend so today’s article will be short and easy, an article for when you want to find your last boot time in Linux. If you want to know when you last booted your computer, there are many ways to get that information. We’ll just cover one way…

We’ve covered a couple of ways to do this in the past. If you want, you can read the following article:

When Did I Last Reboot My Linux Box?

I wrote that article more than two years ago. It was one of my earliest articles. In that article, I covered a couple of different ways that you can find out when you last rebooted your Linux computer. 

In that article, we covered commands like:

There are some advanced commands you can use, so do read the previous article to learn more about how you can find your last reboot time.

In that article, I also mentioned that you could see how long your computer has been on since the last reboot with the uptime command. That’s simply done:

Speaking of the uptime command:

How To: Find Your Uptime In Linux
The Meaning Of “Load Average” On Linux?

Those articles might be of interest. This is a simple article, but it does allow you to read quite a bit more related content.

Find Your Last Boot Time In Linux:

You guessed it. We’ll be doing this in the terminal. That means you’ll need an open terminal. If you’re not sure how to do that, look in your application menu or press CTRL + ALT + T and your default terminal should open.

For this article, we’ll be using the who command. You can check the man page with man who to learn more about the command. If you do that, you’ll learn that the who command is described as:

who – show who is logged on

That may not be as descriptive as it could be. If you just run the following command, you’ll be able to see everyone who is currently logged into your system. That’s just this command:

That simply tells you who is logged in. Your output might look a little like this:

As you can see, I am logged in both on tty7 (the desktop) and tty3.

If you did check the man page, you’d have possibly seen the -b flag. That flag is described accurately:

-b, –boot
time of last system boot

See? Now it should be obvious why I’ve chosen to write this article about how you can find your last boot time with the who command. The command is simply:

Which will output something similar to this:

See? That’s all you need to know if you want to find your last boot time! It’s not all that difficult to get started with the Linux terminal. This is a command any Linux user can learn. It’s also a pretty easy man page to decipher. So, that’d be good for new users as well!

Closure:

It’s a weekend and I’m lazy today. So, you have an easy article. It doesn’t have to be all that easy. I gave you plenty of links that you can (re)visit. Visiting those links will also show you how much the site has changed – specifically with how I write the articles. This particular article is a lot like how I wrote many of the articles, but I’ve been mixing it up quite a bit. I was just really in the mood for an easy article today, so you got this one about using the who command to show when you last rebooted your system.

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.

Yet Another Way To Find Files By Extension

You might look at the title and think that you’ve seen this before, and you have, but this is another way to find files by extension. That’s right! This is Linux! There’s almost always a variety of ways to think about this. There are almost always a variety of ways to accomplish the same task!

Well, this article will touch on a theme we’ve seen before. We’ve seen it recently. I’ve even explained why you might want to find files by their extension type. Fortunately, I’ve even explained the limitations this has.

See a shell script file could have a .txt extension but still work just fine as a script. Linux cares about the file itself more than it cares about the extension. If you have files mislabeled as an .iso file, this operation will still list them as .iso files. This is only about the extension and using that as a search category. It has limitations.

You can read these articles for more:

Another Way To Locate Files By Extension
Find Multiple Filenames By Extension – With Locate
How To: Find Multiple Filenames By Extension

See? It might seem that this article is like beating a dead horse, but it’s not. There are use cases for all of these options, including the option I’ll give you in this article.

Also, it seems like a good day to take it easy. Life has sent me a bit of extra stress. That won’t stop me from writing this article. It seems nothing will stop me from writing these articles!

The ‘ls’ Command:

This is kind of the sledgehammer way to find files by their extension. It’s a good way. It’s even an easy way to remember, without needing extra commands. At the same time, it’s a pretty basic way to do so.

The first command we’ll work with is one you have installed already. You won’t need to add any software to follow along with this article. We’re simply going to use the ls command to list directory contents. 

If you check the man page for the ls command, you’ll see this:

ls – list directory contents

What did I say in the paragraph before that? I said we’re going to list directory contents. Sure enough, Linux provides the perfect tool for this. 

As an aside, what you can accomplish with a basic Linux install is amazing. You can accomplish a whole lot of work without actually adding any additional software. This is awesome. Thank you, Linux.

The ‘grep’ Command:

The second command we’ll be using is the grep command. If you’re a regular on this site, you’ll have used the grep command many times. You can think of the grep command as a filter. You use the grep command to process the output of another command (more often than not) and, more specifically, you use it to filter that output.

You want to use grep when you’re trying to isolate some information. Well, sure enough, we can check the man page for grep. If you do so, you’ll find that grep accurately describes itself like this:

grep, egrep, fgrep, rgrep – print lines that match patterns

You’ll see that grep comes in many forms. You’ll also see that it’s used to print lines that match patterns. The command is filtering out those lines that don’t match the prescribed pattern.

In fact, I used it as an example in the previous article:

Find Out When A File Was Created

Scroll down to see how you can use the grep command to filter out the lines that aren’t important when you simply want to find out when a file was created. Simple, eh? Yes… Simple!

Find Files By Extension:

As you can guess, we’ll be using both the ‘ls’ command and the ‘grep’ command to find files by extension. As those are terminal-based commands, this will be a terminal-based article. You’ll need to open a terminal and you can (more often than not) do so by pressing CTRL + ALT + T.

With your terminal now open, this is the syntax I want you to use for this exercise. We’ll keep it simple:

If you’ve used mix-case, maybe having extensions of .TXT (in capital letters), you can add the -i flag to the grep command. That will (don’t forget to check the man page) tell the grep command to ignore the case. So, an example of the syntax for that command might be:

For example, I might want to search my ~/Downloads directory for .iso files, finding the various distros I’ve downloaded on this computer. If I wanted to do that, my command would look like this:

And, sure enough, here’s an example output from that very command:

See? That output shows you all the .iso files that I have in my ~/Downloads directory. There’s no fuss. There’s no muss. It’s just a simple way to find files by extension.

Anyone can do it and they won’t need any additional software to do so. Everyone (except maybe someone with a very light embedded Linux system – and probably still them) can find files by extension without adding anything to their system. It’s maybe a bit creative, but it’s effective. I’m not sure about you, but I like effective things. This meets that definition squarely – it’s effective.

Closure:

Well, I guess this is still a fairly long article. I’ve been making them longer and this one just got written that way. My style of longer writing isn’t without thought. I have altered the format of these articles a half-dozen times.

Each time I do so, I do so for you. The goal of altering the format is to make it easier for you to digest and to offer more information than previous articles – even for the more basic articles like this one. I do not know if I’ll settle on this style. Evidence would suggest that I’ll improve upon it as I go.

I welcome feedback on this. I don’t suppose you’ll give me that feedback. The odds are good that you won’t even read this far down. Still, please let me know if you like the current writing style. I’ve consistently written to a formula, but that formula has changed over time. This is the most recent iteration, so please let me know what you think. Thanks!

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.