Unzip .gz Files With gunzip

You can just as easily do this in a GUI, but we’ll be using the Linux terminal to unzip .gz files with gunzip. Why? Because we can! You never know when you’ll be limited to a terminal and need to extract the files found in a .gz file.

If you do some searching around the web, you’ll see that .gz files are made with gzip. If you do some more digging, you’ll learn that gzip is both a file type and the name of the application. The .gz files are referred to as gzip files.

While you may encounter just plain .gz files, you’ll often find them as ‘tar.gz’ files, meaning they’ve been prepared for tape archives. You can read about that here:

Let’s Decompress A File (tar.gz) In The Terminal

You won’t need to install anything for this article. The tools will be installed on any major distro – and even on most minor distros. Gzip has been around for more than 30 years, at the time of this writing, and is widely used – even though there are many other compression tools out there. The .gz format is not patent encumbered, nor is it proprietary.

We’ll be using gunzip to unzip .gz files. If you check the man page, you’ll see:

gzip, gunzip, zcat – compress or expand files

As you can see, that means it is the right tool for the job. You can just as easily use ‘file-roller’ in your GUI to unzip .gz files. You have choices!

It’s currently a Sunday evening and my last few articles have been quite long. I think we’ll keep this one short. I might as well…

Unzip .gz Files With gunzip:

As I mentioned earlier, you can do this with a GUI application. We’ll be unzipping .gz files in the terminal. Just press CTRL + ALT + T to get your terminal open and we can begin.

The first thing you need is a .gz file.

Download example.gz here: Link

With that freshly downloaded, you can use cd to get to your ~/Downloads directory (or whichever directory you used):

Now, you can simply extract the contents, like so:

If you want to extract multiple .gz files at one time, try this:

If you want to extract all the .gz files in a folder, try this command:

There you have it. That’s all you need to know if you want to unzip .gz files with gunzip. It’s not even a little complicated. Anyone can figure this one out.

Closure:

I wasn’t kidding when I said I’d keep this one short. There’s no reason to make it all that long and it’s a weekend. It’s also a holiday weekend and you got a lovely article on Saturday. This one is just a simple task, for those who might want to unzip ..gz files with gunzip – in the Linux terminal. It’s pretty easy!

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.

Enable fsck On System Start

If you ever want to check your filesystem’s health in Linux, you might have wanted to enable fsck on system start. This is some maintenance work that we should probably consider performing regularly. Verifying the health of our data is not a bad thing and it doesn’t even take that long.

When you run fsck, you’re not checking the hardware’s integrity. That’s something done with S.M.A.R.T. and is something else you might want to check regularly. This is checking the integrity of our data, the health of your partitions, and that sort of thing.

I’m inept and didn’t remember to write this ahead of time, so this was written after eating way too much and a few glasses of wine. You have been warned.

Anyhow, I’ve written about fsck before:

Repair Your Linux Filesystem With a Live USB or DVD
How To: Check A Disk For Errors
A Couple More Ways To Find Your File System Type

If you get a minute, those articles might interest you.

What Is fsck:

You won’t need to install anything in this article. If you hunt around the ‘net, you’ll find that fsck somehow stands for ‘file system consistency check’. Please don’t blame me, I didn’t name anything. You’ll find that fsck is installed by default on most anything UNIX-like, including the BSD family and MacOS.

You can run fsck manually against unmounted partitions. In this case, we’ll make that easier by running fsck during the boot process. We’ll be telling fsck to run during the startup process. This means it’ll run automatically when you reboot.

If you check the man page for fsck, you’ll see it’s described like so:

fsck – check and repair a Linux filesystem

So, this is the correct tool for the job. If you look further, you’ll also come across this bit of information:

fsck is used to check and optionally repair one or more Linux filesystems.

You can verify that fsck is installed with this command:

The output from that command will tell you the version and the bit about ‘util-linux’ will let you know why I can assume that fsck is installed by default.

We’ll also be using the following tool…

What is tune2fs:

The tune2fs application is the tool we’ll be using to schedule the fsck command. The syntax is quite simple and you’ll be a professional in no time. If you were to check the man page, you’d see it described like this:

tune2fs – adjust tunable file system parameters on ext2/ext3/ext4 filesystems

NOTE: It’s important to realize that this is only going to work if you’re using one of those three formats. If you’re not using an ext* formatted partition, this isn’t going to work for you. There are other tools. This one is not for you.

The tune2fs application is almost certainly installed by default. If you check the man page it says it’s an invalid option – but it does tell you the version. Which means you can ensure that it is installed. However, you can just as easily verify that tune2fs is installed with this command:

While that won’t give you a version number, you don’t need to know the version. This is one of those applications that are robustly finished, for lack of a better term. It’ll work with your system.

lsblk:

We will also be using lsblk. We’ve used this command many times. Several other commands will get you the same information, but lsblk is a nice and easy example. If you check the man page, you’ll see that lsblk is described as:

lsblk – list block devices

Which, as you can see, is exactly the right tool for the job. Block devices are, in this case, drives and partitions. We’re interested in the partitions for this exercise. It’s a basic Linux utility and will be installed by default. You can verify that lsblk is installed by default with this command:

If any of these tools aren’t installed by default, please leave a comment. I don’t think I can recall a server or desktop distro that doesn’t have these basic tools installed by default. You shouldn’t need any additional tools for this exercise.

Enable fsck On System Start:

If it’s not obvious, fsck is a tool usually called from the terminal. I’m sure a GUI frontend exists somewhere, but that’s not covered in this article. So, press CTRL + ALT + T and let’s get started learning how to enable fsck when you start your system up.

First, let me cover another method. If you want to run fsck on the next boot and against your root partition, you can skip all of this and just run this command:

I think I’d be doing you a disservice if I didn’t mention that. The next time you reboot the device, it will run fsck on the root partition. It will clean itself up afterward and only run it that once, assuming all goes to plan.

What we’ll be doing is using tune2fs to schedule running fsck. We’ll specify the disk name and the frequency at which fsck is run. You’ll have options with the tune2fs method. I’ll explain them as well as I can.

Enable fsck With tune2fs:

With that open terminal, we need first to find the name of the partition you want to check. For that, we’ll use the lsblk command. The syntax is easy.

An example output from that command would be:

We are interested in the name section, which is sda* and we’ll be adding /dev to that name.

In this instance, we can see that there’s an efi partition and that efi isn’t an ext* formatted partition. So, that leaves us with sda2. As you learned earlier in this article, we could just run fsck against the root (the / partition) easily enough. So, in this article, we’re going to refer to sdb1 and you’ll apply it to your personal needs.

The syntax to enable fsck on system start is quite simple. I’ll give you an example:

So, let’s say we want to run fsck on sdb1 the next time we reboot. The command would look like this:

If I want to run this command every tenth time the system reboots, I can do that easily. I’d run this modified command:

You can schedule fsck easily this way, and apply it to different partitions without much additional effort. If you want to set it to check every 25 times, you can do that. You can just set it and forget it and then you’d have a slower boot time every 25 system starts because the system would be checking the drive(s) for errors.

When you’re done, you can disable this command easily enough. Just change the frequency to zero. If I were to disable fsck from running at system startup, I’d run this command:

That’s all there is to it. I’m sure you can manage. Hopefully, those directions are clear enough. If not, you can always ask questions!

Closure:

Well, I didn’t expect I’d write a long article tonight. I expected it to be a short and easy article. You can see how that turned out. Though, if you ever need to enable fsck on system start, you now know how you can go about doing so.

Best of all, assuming I’ve done my job well enough, you’ll be able to do so easily and without mistakes. However, mistakes with just this won’t be too worrisome. I suppose the worst case is that you check your filesystem’s health more often than you want to. Even then, that’s easily corrected. 

You might want to write down how to cancel it or remember this page so that you can return to remind you how to disable it. It’s not complicated and might even be stored in your bash history file so that you can reference it easily.

Either way, I hope you all had a happy Thanksgiving – if you celebrate. If you do not celebrate, I hope you had a happy Thursday! As for me and mine, it was a pretty good day. I have no complaints, other than there wasn’t a giant snowstorm to make things interesting.

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 Your Filesystem In The Linux Terminal

Today is going to be a good day if you have decided that you want to show your filesystem in the Linux terminal. If that’s not what you want to do, this might not be the article for you! If it is what you want to do, read on!

I’m going to try to keep this fairly short. There are two commands that I have available to help you show your filesystem in the Linux terminal. There are surely other ways to do so, but I’ll just cover two different ways.

Both of them will be quite simple…

These two commands should be fairly standard. They should work in your distro, regardless of which distro you’ve chosen. There’s nothing special about them.

What do I mean when I say ‘show your filesystem in the Linux terminal’? I mean you can see, and identify, your various drives and their partitions. You can also learn a bit more information about them, but the general idea is that you can see and learn about them in the terminal.

Like I said, this won’t be fairly complicated. It will involve the terminal.

Show Your Filesystem In The Linux Terminal:

Yes, I said the terminal. You will need an open terminal. If you want to open your default terminal, you can usually just press CTRL + ALT + T. That will open your default terminal more often than not. Otherwise, open it from your terminal.

Now, to get to the point… I’m going to show you a couple of commands that you can use to show your filesystem in the Linux terminal. 

Ready?

lsblk:

The first tool we’ll use is lsblk. This is installed by default on any major distro and you won’t need to install anything. If you check the man page, you’ll see that lsblk is described like this:

lsblk – list block devices

That command sounds useful. Block devices are disks, drives, partitions, and the like. So, you can just run that command in the terminal. It looks like this:

The output is easy enough to understand. It might look something like this:

That’s with a bunch of junk still plugged in from a previous article. You can see that the output is easy enough to understand.

df:

The next command we’re going to use is the ‘df’ command. Again, you shouldn’t need to install anything to use the df command. This is something that should already be installed and if you want to use it to show your filesystem type in the Linux terminal, it’s quite easy.

First, you should check the man page. If you do, you’ll see that df is described as:

df – report file system disk space usage

Once again, that sounds like a fine tool for learning about your filesystem. You’ll want two flags. The first flag is -T and will show you the file system type. The second flag is -h and that means it’ll spit the output in human-readable form. An example of that command would look like:

An example output would look like this:

Again, that’s nice and easy to understand. If you want to show your filesystem information, these commands are easily memorized.

You’ll notice that both output is quite similar, as it should be. There are only so many filesystems available in the distro I used to write this. This information can be quite a bit more complicated if you’re running it against a NAS with lots of different storage options, but it’s generally easy enough to understand.

Closure:

There you go… This isn’t even a very long article – because it doesn’t need to be. I wanted to show you how to show your filesystem information in the Linux terminal. None of these commands are all that difficult to use and remember. You can also get some useful information from the mount | grep "^/dev" command, so keep that in mind along with the commands shown in this article.

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.

List Installed Software In Lubuntu

There may come a point in your Linux journey where you must list the installed software in Lubuntu. This is easily done and I will show you a couple of quick ways to get this list in the terminal. So, if you want to list installed software in Lubuntu, this is the article for you!

I’m writing this article because it’s quick and easy. I won’t make this article as long as I’ve made recent articles. We’re just going to get to the point, more or less. I will show you a couple of different ways, each with its own merits. You can decide which way works for you.

The article headline and related material reference Lubuntu. That’s because I’m using Lubuntu when I write this article. I am a Lubuntu member, after all. It makes sense that I’d be using Lubuntu!

Plus, it’s a weekend. I’ve formalized the idea that articles written during weekends will be easier. I have a life outside of writing articles and doing other things to help the Linux community. (It’s amazing, but it’s true!)

However, you can use these commands on anything that uses dpkg or apt. That means you can use these commands on Debian, Linux Mint, Ubuntu, and myriad other distros that use .deb files as their software packages. These commands are fairly universal across those distros and you shouldn’t have any issue running either of them on any of those machines.

Caveat:

The following commands will not show you Snap packages or flatpak packages. Software installed by those means does not show up in these commands. Only software installed with dpkg/apt (which includes all .deb packages even if you used a GUI installation method) will be shown.

Fortunately, that’s not a problem.

To show flatpak applications:

To show Snap applications:

AppImages aren’t really installed and I can find no way to list those that make sense. Sure, we could use the find command and list any .appimage file, but that won’t tell us if you use it. We’ll just ignore those for the sake of simplicity and to stay within the realms of ‘reasonable’.

List Installed Software In Lubuntu:

In the opening paragraph, I mentioned that this was something you’d be doing in the terminal. That means you need an open terminal. As you’re using Lubuntu, you can just press CTRL + ALT + T and QTerminal should open right up.

With your terminal now open, the first command we’ll be using is dpkg. This will not show all the installed applications at the same time. This outputs a nicely formatted list. You can see the version of the software on the right. It’s easy to understand.

It will show you a page at a time and your arrow button lets you scroll down to see them all. To exit the list, you press the Q button on your keyboard. To list installed software in Lubuntu with dpkg, you simply run the following command:

The second command might be a little more useful, but it’s not formatted nearly as nicely. This time around, we’ll be using the apt command. If you don’t know, apt is basically a front end for dpkg. Now you know.

If you want to use apt to list installed software in Lubuntu, you would just run the following command:

That will spit out the entire list, though you could pipe it to the less command. To do that, try this command:

That will output the list a page at a time. Like the above dpkg command, if you want to exit the list, you just press the Q button on your keyboard.

This command is also useful to create a list of installed applications. Again, this won’t list Snaps or flatpaks, but it will list the traditionally installed applications. That means it’s pretty useful to create a list, especially if you want to recreate the system later. To do that, just run this command:

There you go, you now have a handy list of installed applications in Lubuntu! Pretty easy, isn’t it?

That’s all there is to it today. 

Closure:

Yeah, it’s a weekend. This article might just break 800 words, so it’s not nearly as long as many of my recent articles. This time around,  you’ve learned how to list installed software in Lubuntu. It wasn’t even that complicated and you’ve been given the choice between two commands. Just pick the one that works for you and commit it to memory. You’ll be golden and have taken one more step in your route of Linux learning.

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.

A Quick Look At The Cat Command

If you want to view the contents of a text file in Linux, you have something called the ‘cat’ command. Being able to use the cat command is important. This article will give you a quick look at the cat command. After all, this was written during the weekend and a quick article seems like a good idea.

It’s possible to view text in the terminal. Many files are just that, able to be read as text. This isn’t true for all files, of course. Trying to read a .tar.gz file as text is unlikely to be fruitful. On the other hand, a .sh file would be trivially read as plain text.

When you’re manipulating text in the terminal, you want a tool like Nano. When viewing text in the terminal, you can use a tool like the cat command. It’s a handy tool.

The cat Command:

You shouldn’t have to install anything. If you enter cat --version in the terminal, you’ll get an output like this:

As you can see, the cat command is a part of the GNU core utilities and, as such, should be installed on almost all Linux systems by default. This means you won’t need to install anything.

If you check the man page, with man cat, you’ll see that it’s described like so:

cat – concatenate files and print on the standard output

Other than the big word concatenate (which means to link files together), you can see that this is the correct tool for the job. What you type in is standard input and what comes out in the terminal is standard output. (That’s often referred to as stdin and stdout, respectively.)

As we’re going to be taking a quick look at the cat command, you might as well understand what it’s for and what it’s expected to do.

Using The cat Command:

As suggested above, this requires an open terminal. Press CTRL + ALT + T and your terminal should open. That’s not always true, but it’s true more often than not.

With your terminal now open, let’s start with something you should have – that is a ~/.bash_history file. If you don’t have a ~/.bash_history, pick a different text file that’s in your current directory (PWD) by using the ls command to search for such. You might have a ~/.bashrc for example.

Now, let’s just view that ~/.bash_history file in your terminal.

If you’re like me, that’s a great deal of text. You’ll need to scroll up to view all of the text, but the cat command is pretty helpful like this.

Let’s say you wanted to create a new file. You may want to read this article:

How To: Write Text To A File From The Terminal with “>” and “>>”

Using the information from that, you can use the cat command to create a new file with this command:

So, try the following:

You should see that there’s now a file named ‘foo’ in your PWD.

There’s a lot one can do with this cat command. You can show the contents of more than one file at a time, like so:

Using the same concepts from above, you can even use > or >> to take the output from cat and insert it into another file.

Finally, and cat has so much more to offer – but this is just a quick look – you can tell cat to number the lines in the output. For example:

See? Nice and easy! The cat command will happily show the output with line numbering enabled. This stuff is easy enough to commit to memory because the cat command is surprisingly powerful for such a little command.

Closure:

So, yeah… It’s a weekend. I have written some larger articles during the past few weeks. That means an easy day is always welcome. Don’t forget that you can make it easier on me by writing an article for the site! I do welcome contributions and it doesn’t matter much if it’s something I’ve already covered – so long as you do a better job than I did!

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.