Meta: The State Of Linux-Tips #17

Today you’re just going to get a quick meta article, where I go over the state of Linux-Tips (this site, obviously). It has been a while since I did the last one, so it’s time to do another one. I’m thinking I’ll keep this one brief. I’ve had an adventure today, dealing with some medical stuff, so a low-energy article is a good idea.

I try to do a meta article every month. I haven’t always managed to do so, but it’s a sorta goal. It’ll be fun to share what’s going on. It’s not all that informative, but I try to make it as interesting as this kind of article can be.

So, if you want a day off you can just skip this article. If you’re interested in what’s going on, read on and enjoy the meta article.

The State Of Linux-Tips #17

So, traffic really hasn’t grown or changed much. This month we’re going to do better than last month, but not drastically so. Google appears a little annoyed with the site again, but I don’t worry any more. Frankly, the site gets plenty of traffic as it is. 

Someone did donate recently. I’m grateful for that. The funds went to pay for hosting, though I suppose they more specifically went straight to my CDN provider. Why is it worth the money to pay for a CDN?

The site loads quickly no matter where you are on the planet. On top of that, you’ve never seen a minute of real downtime. You might have seen a temporary screen while updates happened, but the server has pretty much 100% uptime. I decided to add a monitor fairly recently – but in that time the server hosting the site has gone down.

This site did no such thing. The CDN still presented you with static content, which is what this site mostly is. If you attempted to interact with the site during the outage, the CDN (it’s both WordPress and LiteSpeed specific) will cache your request and process it when the site is back online. So, you’ve almost certainly never seen the site go down.

Now that I said that, watch there be some big outage that takes the site offline for a few hours! Ah well… I’ll risk it. If you whois the domain, you’ll see the nameservers which will clue you in as to which CDN I use. They’re very specialized and likely won’t work for many of you. I think it’s worth it, but it’s an annoying monthly fee. (Even if I have to fund it entirely by myself, I will continue doing so. Donations are nice, but the site will survive without them.)

Anyhow, thanks for the donation! (I have to find the motivation to wrap the site up as a PDF to give away to people who donate, something planned for the future, but I’ll make sure it’s available for them. That seems like a good idea. 

Some Stats:

So, like always, the VAST MAJORITY of my traffic comes from Google. I suppose the state of Linux-Tips depends heavily on the traffic.

Well, this might not seem like much, but last month we went through more than 35 GB of bandwidth. I’m having some issues with backups, so the site was also using almost 20 GB of disk space. That disk space consumption has since been reduced significantly!

Some Demographics:

Roughly 92% of my traffic is from Linux users.
Just about 80% of my traffic is from Chrome/Chromium-based browsers.
Roughly 80% of my traffic originates in the United States.

The top 3 articles read in the past month:

Find Out Which Display-Manager You’re Using
How Do I Install Linux (A General Guide)
How To: Disable Sleep And Hibernation on Ubuntu Server

Other Stuff:

The site is attacked about 400 times on an average day.
Most of the attacks appear to come from compromised servers.
Only about 70 people have signed up for the newsletter.
AWStats claims I’ve displayed > 600,000 pages in May.
There are about 50 articles that show up in Google’s top ten listings.
As I learn more, I realize I have no business being a WordPress admin.
This changed! In May people spent an average of 171 seconds on the site.
One visitor was using Symbian OS.
Four visits were from someone using Sun Solaris.
We’re now over 280,000 words on the site.
It’d take you 19+ hours to read all of that.

Closure:

And there you have it… You have another meta article, an article about the state of Linux-Tips. You probably didn’t learn anything important, but now you know what’s going on here and what you can expect in the future. I expect to continue to write these articles for the foreseeable future. Don’t forget that I accept on-topic guest articles. (I get so many requests for stuff that’s not on-topic. I’ve stopped responding to the people too lazy to read the site and understand what’s going on here.)

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 Out What A File Is

Today we’ll have a simple article, one that shouldn’t take too long, as we learn one way to find out what a file is. It’s a handy command, but it won’t take all that long to explain. So, we’ve got that going for us!

The command we’re going to use is one that you almost certainly have installed by default. That command is the ‘file’ command. The man page describes file as:

file — determine file type

Linux pretty much treats everything like a file, pretty much. Files also contain a ‘magic number‘ – which is why you can rename an mp3 file as a gif file and it’ll still open in your media player. Basically, the magic number is the opening two bytes of a file that tell your system what kind of file you should be expecting. 

If you change the file extension it won’t fool the ‘file’ command. You can rename it with any extension you want and ‘file’ will know what the file is. Of course, it might be a text file, a compressed file, a Debian installer, etc… There are all sorts of file types out there. There are hundreds of file types just for image files.

So, yeah… We’ll be using the file command in this exercise. Let’s get to it!

Find Out What A File Is:

Like oh so many other articles, this one requires an open terminal. We do a great deal in the terminal. You can press CTRL + ALT + T and your default terminal should open.

With your terminal open, you’re probably in your home directory. So, the vast majority of you should be able to run the following command:

That file contains a bunch of the settings you see affected in the terminal. As you can see from the output, it’s an ASCII file, meaning you’d edit it with an ASCII (plain text) editor.

If you want, you can navigate to your Downloads directory and use ls to list the files. From there, you can run the file command on files you’ve downloaded. For example, I could run:

The output from that command would look like this:

The file command knows what the file is. It’s pretty accurate. It doesn’t matter if I change the .deb to .gif. 

See? Renaming the file didn’t fool the system. However, it might fool some applications. For example, if you click on that “.gif” file, your system might try to open it as an image and throw some sort of error. The file command can be pretty handy in those situations, where you’re not sure what the file type is and how you should approach it.

Closure:

Well, if you ever wanted to find out what a file is, you now know how. Over your computing journey, you may very well find you need to rely on the file command to know what the file type is. It’s a pretty handy command for when you need it. Of course, you could go so far as to edit the magic numbers to fool the command, but you’d probably know if you did that.

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: Install .DEB Files In Ubuntu

Today’s article is only useful for a subset of my readers, that is those who need to know how to install .deb files in Ubuntu. That’s a bit cheeky of a headline, but there’s a character limit to adhere to. So, if you want to install .deb files in Ubuntu, this article is for you…

What are .deb files?

The .deb file extension means that it is a package meant to be installed in Debian. So, this article will be valid for all Debian users – even those downstream, like Ubuntu or Linux Mint.

Quite a few Linux distros use .deb files, not just Ubuntu. I happen to be an Ubuntu member and many of my readers use distros based on Ubuntu (which is, of course, based on Debian). To keep things short, we’re not going to type all that out over and over again.

Many new users start with Ubuntu or Mint, and Debian itself of course. You might be a new user and have reached the point where you’re comfortable installing software from the graphical installer built into your operating system of choice.

Well, this is Linux… There are all sorts of ways to do things! Assuming you’re safe, or unsafe if you want – it’s your choice, you can find software that’s not available in the graphical installer, or newer versions than what you’ll find in the graphical installer. You’ll often find this software available in .deb format and this article will show you a few ways to install those .deb files.

How To: Install .DEB files in Ubuntu:

The first way we’re going to cover will be in your terminal. You’ll likely need an open terminal for the rest of the methods, so you might as well open your terminal now. You can just smash the CTRL + ALT + T and your default terminal application should pop open.

The first method is pretty easy. You’re simply using ‘apt’ in the terminal, much like you’d do if you wanted to update from the terminal. The command would look something like this:

You’ll usually have downloaded the file to your Downloads directory, so you can either navigate to Downloads using the cd command or you can just include the folder in your path to the file, kind of like this:

Of course, you’ll use the actual file name and you’ll be asked for your password (unless you’ve changed that). Enter your password and let apt do its thing. Using apt is great because it will do its best to resolve any dependency issues you might have.

Now onto some GUI ways to install .deb files in Ubuntu!

Install .DEB Files With GDebi:

You followed the directions above and have an open terminal, right? Good, because GDebi doesn’t always come installed by default. I’ve previously written an article about GDebi, but it’s actually on the old site. I won’t bother linking it.

GDebi is a great GUI, that is a graphical, way to install .deb files. In fact, on the man page, it is described as:

gdebi – Simple tool to install deb files

To install .deb files with GDebi you first need to install it. You can do that right there in the terminal. To install GDebi, just run this command:

Once you have GDebi installed, you just use it from the right-click menu. Use your file manager to navigate to the download’s directory. Then you just right-click on the .deb file and choose to install it. The first time around, you might need to do some sort of ‘open with’ exercise, but then it should appear as something like “Open with GDebi package installer” or you will pick it from a list.

I’m positive you can figure it out from there. The great thing about using this GUI method to install software in Ubuntu is that it too will attempt to deal with any dependency issues automatically.

Install .DEB Files With QApt:

Do you still have that terminal open? Good! We have one final graphical method to install .deb files in Ubuntu. This one is a fairly new application and it’s a Qt application. However, it installs with very few dependencies and takes up very little space. Functionally, it’s very similar to GDebi.

So then, let’s start with getting QApt properly installed. The name is quite a bit longer, but it’s still easy to install QApt. To install the software, try this:

It’s a nice and light way to graphically install .deb files. For the life of me, I can’t figure out the correct man page incantation to make it work. No amount of trying the various words results in a man page opening. I do not know why, but I do know that it works. If you search to install QApt, it describes itself as:

qapt-deb-installer – tool for installing deb files

That’s plenty accurate. That’s what it is and that’s what it does. While I can’t find a man page for QApt, that’s an adequate description.

This QApt is a bit different. Like with GDebi, you’ll use your file manager to navigate to the directory that contains your .deb file (usually the Downloads directory) and right-click on the .deb file you wish to install. You’ll then pick “Open With” and click on the “QApt Package Installer”. With QApt now open, you’ll just click the obvious install button and wait patiently for it to do its thing.

Closure:

So, there you have it… You have another article and this one has you learning how to install .deb files in Ubuntu. There are a few ways and you can pick the one that works best for you. Much of the time, I already have a terminal open and already navigated to the ~/Downloads directory. Because of this, I’ll often just do the installation right there in the terminal, using the apt command. But, it’s up to you. You have choices!

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: Not Save A Command To Bash History

Today’s article is another short-form article, where the subject is how to not save a command to bash history. It’s trivially easy and something everyone can learn. So, read on and learn how to not save a command to Bash history.

The vast majority of my readers are going to default to using Bash. 

bash – GNU Bourne-Again SHell

You’ll access Bash through your terminal and, again as the default, will save x-amount of past commands to a file known as ~/.bash_history. Anything you enter as a command (though not passwords entered at the password prompt, as that’d just be silly) will be saved to that file.

If you’re like me, you use the terminal a great deal. Again, if you’re like me, you value the Bash history aspect but you don’t want it full of trivial or experimental nonsense. You can prevent a terminal input from being saved in your ~/.bash_history – and it’s trivial to do so.

Do Not Save A Command To Bash History:

Seeing as I’ve been doing short-form articles for the past couple, this one seemed like a lovely tip to share with my readers, as I’m sure some will not know this. 

Of course, you’ll need an open terminal for this. Press CTRL + ALT + T and your default terminal should open.

With your terminal now open, we’ll use the ‘ls’ command to list the contents of your present working directory. Ready?

Now, that’ll be saved to your Bash history file. What if you don’t want it saved to that file? Just add a space in front of it, like so:

I don’t know how well that will show up, but trust me when I say there’s a space there. By adding that space, I’ve effectively told the terminal to not save that entry into the history file.

See? Pretty darned simple!

Closure:

So, yeah… I’ve been doing a few short articles and this seemed like the perfect article to do in that format. It’s something not everyone knows, isn’t made immediately obvious, and will likely be of importance to someone. If you’ve ever wanted to not save a command to bash history, that’d be how you do it.

I could have added a few more bash tricks and turned this into a longer article, but I’m having fun with this shorter stuff right now. If you prefer the longer articles, don’t worry. They’ll be back soon enough. These short articles are fun and easy, and they have the added benefit of keeping me interested in writing these silly things.

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: List Open Files

Today’s article might seem unimportant and that’s okay because we’re just going to examine one way to list often files. So, in a way, it’s probably not all that important. If you are someone who wants to list open files, this would be the article for you!

For the most part, most of my readers aren’t going to want to know how to list open files because they just have no good reason to do so. It won’t be a very long article or anything. I did some long-format articles and they didn’t get much feedback. I’ll do more, but I don’t see them as needing to be all that immediate – or consistent. The shorter articles just seem to be what folks are looking for. I can live with that. (If you do like the longer articles, it’s not too late to mention that.)

Today’s tool will be one you may have never heard of. We’ll be using the right tool for the job, however. That tool will be the ‘lsof’ command. The ‘lsof’ command should be installed by default in any major distro and checking the man page will reveal that it describes itself like so:

lsof – list open files

Read that line and then look at the headline. See? I told you that it was the correct tool for the job. If you want to list open files, a tool that lists open files is the tool for the job. Imagine that?!?

List Open Files:

Of course, the lsof command is run in the terminal. As such, you’ll need an open terminal for this exercise. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With your terminal open, you can just run the following command which will show every currently open file (it’s a lot):

You’ll notice some of the output will say something about “permission denied”. So, if you’re going to list all the open files, you probably should use sudo with the command. Like so:

Type in your password at the prompt and be prepared for the deluge of file names. It takes quite a bunch of open files for an operating system to work – and Linux treats everything like it’s a file.

So, what if you just want the output to tell you all the files opened by a specific user? The lsof command will help you out with that. Try this command:

For example:

That command will show you all the files opened by that user. It’s still a lot, but it’s an easier output to process. If you wanted to show the files opened by everyone except a specific user, you’d use this command:

That command would (assuming you removed the brackets) show you all the open files except those files opened by ‘username’. In any of these cases, if you see some permission denied errors you can just slap sudo on the front of it and be good to go.

Closure:

Well… If you’ve ever wanted to list open files you now know how to do so. I suppose it’d mostly be useful for things like auditing or troubleshooting performance issues. I have the command in my book of tricks, but I don’t recall ever needing to use it for much. I’ve played with lsof and it does list open files. So, there’s that.

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.