Check Your Memory In The Terminal: Part II

Today’s article is all about how you can check your memory in the terminal. If it looks familiar, it’s because I’ve already written “How To: Find The RAM Total In The Terminal“, which covered a couple of ways to check your RAM – all of which were in the terminal. I left the article open for others to share how they check their memory, but nobody left any comments.

In the previous article, I invited people to comment and share other ways to check RAM, RAM total, RAM usage, etc… Seeing as nobody commented, I figured I might as well return to the previous article and throw in a couple more ways to do check your memory in the terminal.

The previous article includes some handy tools, such as the easiest way:

While also mentioning a much more extensive and informative tool:

Both of which are lovely ways to check your memory in the terminal.

This being Linux, there’s also other ways.

Me being me, I figure I might as well share them with you.

After all, it’s yet another article that I can write! So, as unoriginal as this article may sound, there’s also a couple of tools I really want to introduce you to. 

There’s always room for more tools, especially if they’ll help you…

Check Your Memory (in the terminal):

As the line above indicates, you’re going to need an open terminal to do the work in this article. You can open it from your start menu, or you can just press CTRL + ALT + T and your default terminal should open right up.

The first tool we’re going to use is ‘top‘. I think you’ll find top installed on pretty much everything, though some distros are including variants like htop. The venerable top application is a terminal-based task manager and has been with us since 1984.

Anyhow, the command is nice and simple. Just run ‘top’ in the terminal:

The output will look something like this:

using top tto find your memory information
Look up near the top, above the fold, you’ll see the memory information. Pretty easy, isn’t it?

The last two lines of data, above the list of tasks, tell you all you need to know (unless you need a ton of details, I suppose) about your RAM, your RAM usage, what’s buffered, etc… It also tells you about swap, another facet of memory. 

Next we have a lovely command called ‘vmstat‘ a tool for showing virtual memory statistics. This lovely tool has been around since 1985 and has a ton of options. It’s an excellent tool and you’re highly encouraged to use the man vmstat command.

We actually don’t need all those lovely options for this. We don’t have to dig down very far to get the information you need. In fact, once again, you’re going to run the command without a single flag, like so:

The outcome of which is also self-explanatory. It looks like:

vmstat showing information, including ram information.
Look under the line clearly marked memory. See? There it is! There’s the memory info!

Just look under where it’s clearly marked ‘memory’ and you’ll see that you can use this to check your memory. It’s a bit more cryptic as it doesn’t directly show the total – but it does show you the information that’s actually important.

The total doesn’t matter. What really matters is how much RAM you’re using and how much RAM you have free. But, vmstat being vmstat, it will of course give you that information if you want it. If you do want that additional information, just use the --stats flag – like this:

Where you can see an output similar to this;

use the --stats flag to get a ton of memory information about your memory.
It contains not just that, but all sorts of information about your memory!

Pretty sweet, huh?

Closure:

There you have it, a follow-up article that tells you how to check your memory. After all, nobody wanted to add them as comments! Either way, you got to play with a couple of new tools, or at least tools not really mentioned here on this site.

Speaking of the site, the end of my year long project is in less than 2 months. That’s right, I’ve kept this up for this entire time, with a few guest articles in between. I’ll do a meta article, but I have to say that this has been a pretty fun (and educational) project. Maybe we’ll keep it rolling? It seems likely that I will. I quite like writing these 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 own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Install And Secure MariaDB In Ubuntu

I’ve recently purchased a couple of new VPSes (spelling?) and so today’s article is about how you install and secure MariaDB. As mentioned before, some articles are just going to be me scratching my own itch. In this case, I have a couple of virtual private servers that are doing nothing more than costing me money. I might as well put them to good use.

So, what is MariaDB? It’s a database management system that’s a fork of MySQL. Oracle purchased Sun Microsystems in early 2010 and MySQL went with it. Quite a few people didn’t trust Oracle’s stewardship of MySQL, they were already known for their own database management system, and so MariaDB was born.

MariaDB is actually a fork of MySQL. MariaDB is also permissively licensed, while the newer MySQL has an enterprise version with proprietary code in it. MariaDB is completely open and works just fine under a number of FOSS licenses.

MariaDB is just as fast, and faster in some operations. It supports the native languages used with databases. It’s well supported with a vast number of installs running some of the largest databases on the planet. MariaDB is one of many MySQL forks, which is to be expected. After all, MySQL was the first of its kinda – a free database management system that was released at a key  point (mid 1990s) of Internet development.

In my observation, and despite all its goodness, MariaDB a testament to exactly how much people dislike and don’t trust Oracle! So, then, why not…

Install And Secure MariaDB:

As this is server related, you’re likely to be doing this in a terminal and you’re likely to be using SSH to do so. So, I’m going to assume you already have a terminal open, saving us some time.

Make sure you’re fully updated before attempting this, so:

Now, we’ll go about installing MariaDB. It’s trivial, just run:

That’ll take a minute and, when done, you can verify that the MariaDB service is up and running properly. That needs this command:

MariaDB should be installed and running – but it’s woefully insecure. In order to secure the MariaDB installation, you will want to run the following command:

It’s going to first ask you for your root password. You’ll enter your default root (sudo) password. One of the questions will let you assign a different password for MariaDB and it’s strongly recommended that you do so. For the other few questions, you can read them or you can just answer yes to all of them, as all of them are the best choices for securing your databases.

That’s actually all there is to it. You’ve learned to install and secure MariaDB. It’s one of the many steps you might take if you wanted to set up your own server, so be careful when you’re doing so and opt for the best practices.

Closure:

There you have it! It’s another article, this one tells you how to install and secure MariaDB. In some cases, rare cases indeed, you might want to open it up to connections outside of localhost. If you do that, be sure to open up the correct port in the firewall. Other than that, you’re good to go.

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 own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Test Your Bandwidth From The Terminal

There are all sorts of ways that you can test your bandwidth rate from the terminal. This article is going to cover just one of them. As far as articles go, this one should be pretty easy for anyone to follow and understand. It should also be relatively quick.

So, there’s that…

Which is nice…

The tool we’ll be using is known as ‘speedtest-cli’. You may be more familiar with their website, speedtest.net. If you, like most, visit the site, you can have your bandwidth tested in a number of ways and from a variety of servers. You can do that from the terminal, if you want.

Speedtest.org is pretty handy, though I’d probably recommend librespeed.org to folks who are testing via the web. The latter has no Java, websockets, nor Flash. It is also open source. On the other hand, it lacks a way to easily test it in the terminal.

So, what is speedtest-cli? It’s a way to access the speedtest.net tests via the terminal. There are a number of options and I’ll cover the most important of those options below. For now, speedtest-cli defines itself as:

speedtest-cli – Command line interface for testing internet bandwidth using speedtest.net

That’s a pretty accurate description of what it does. It’s also the tool we’ll be using. It’s just easier and fancier than other ways. Sure, you can download a large file in the terminal and get a good idea of what your download rate is, but it’s not much of a test and doesn’t include things like your upload speed.

Test Your Bandwidth:

As stated above, you will test your bandwidth rate in the terminal. To do this, you’ll obviously need an open terminal. To open your terminal with a keyboard shortcut, just press CTRL + ALT + T and your default terminal should open.

Install speedtest-cli:

So, speedtest-cli is unlikely to be installed by default, you’re going to have to install it. If you go to their official download page, you’ll get to download a script form of the application for pretty much every architecture out there. Those will work just fine and have directions about how to use them.

But, you can probably properly install speedtest-cli. For example, if you want to install it on Ubuntu, your installation command would look like this:

I didn’t check every other distro, but it sure looks like it’s available in the default repositories for a bunch of them. Even in Manjaro, I was able to install speedtest-cli with this command:

And all was good with it installing without any need to mess around with scripts or installing it manually. As near as I can tell, it works the same for Fedora and even CentOS. Just use your package manager to do the installation and it’s probably in there.

Test Your Bandwidth With speedtest-cli:

Next, you’re going to want to run speedtest-cli. If you’re familiar with the web interface, the terminal interface won’t seem too terribly foreign. By default, the bandwidth test will be done with the closest servers to you (based on IP address geolocation). You can also pick the server you want it to test your bandwidth with, overriding the default choice.

If you want to run the command that’d give you the results you’d get by using the defaults on the web page, you just run the command without any flags at all. It looks like:

If you want to list servers based on distance from your location, then you first need to run this command:

That will show you servers and their associated server number. Using that number, you can pick which server you want to use with this command:

Those commands will happily give you the test results right there in the terminal, but you can also opt to generate an image. To do that, you use the --share flag. So, a basic command would look like this:

After it spits out the results, it will give you a URL to an image generated based on your individual results. I suppose this is good for bragging rights or for demonstration purposes when complaining about your throughput to your ISP. An image generated from a VPS of mine looks like:

speedtest-cli results from a VPS
That’s obviously from a VPS. My bandwidth isn’t that good! It’d be pretty sweet if it was!

You can use that image to show off to your friends or, as mentioned, a demonstration for how poorly our ISP is serving you. This is one of a few ways you can tell if your provider is actually providing you with the services you purchased.

Those are pretty much the only ways you’re going to use speedtest-cli in the real world. There are a few more options, so be sure to check the man page. As a general rule, most folks are going to just want those options and those results.

Closure: 

And there you have it. You now have a new article. This one is telling you how to test your bandwidth with speedtest-cli, a test you may find useful from time to time.

The bandwidth from my house? Well, I have a lot of stuff using the ‘net on this line right now – but it’s still enough bandwidth for my needs. It’s not nearly as impressive and the results look like this:

speedteest-cli results from my home
As you can see, it’s not that high. That’s actually a bonded DSL line and twice what it used to be!

It’s useful testing to see if you’re actually getting the bandwidth you paid for. Sadly, ISPs are aware of the IP addresses speedtest.net uses and folks tell me that they’re prioritizing traffic from that service (meaning giving you better results than reality would give you) but I have no idea if that’s true or not. To be fair, it does sound sleazy enough for an ISP to do it, though I’ve had pretty good luck with the service providers I currently use.

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 own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Find Large Files Using ‘ncdu’

In this article, we’ll learn how to find large files by using ‘ncdu’. It’s useful for spotting large files that eat up your disk space. We’ve previously had an article about visualizing disk usage. Those were some great GUI ways to find large file, but this will be done inside your terminal – and using ncdu.

You’ll find that ‘ncdu‘ stands for NCurses Disk Usage. As the link says, it refers to the similarity with ‘du’ and that it uses the [n]curses programming language. As far as tools like this go, this one is relatively new (from 2007). Unsurprisingly, ncdu defines itself as:

ncdu – NCurses Disk Usage

There are a ton of options for ncdu and we’re only going to touch on just one of ’em. The goal isn’t to teach you how to use ncdu, it’s to teach you how to use ncdu to find large files. If you want to learn more about the tool, you can always refer to the man page.

Now that we understand the scope of this article (how to find large files using ncdu) we can move on into it…

Find Large Files Using ncdu:

Chances are good that ncdu isn’t installed by default and you’ll need to install it. It’s also a text-based application. So, obviously, you’re going to need a terminal open. You can easily open a terminal by pressing CTRL + ALT + T. That should open your default terminal.

Now, you’re going to need to install ncdu, and one of the following commands should cover the most popular distros:

Fedora:

Debian/Ubuntu: 

Manjaro/Arch: (Note: Should work, threw PGP error in my testing VM.)

openSUSE/SUSE:

RHEL/CentOS: (Note: Needs epel-release.)

Or whatever… It’s available for any distro I could think of to check, and it’s trivial to install it. If you’ve been following this site long enough, you can figure it out. I have the greatest confidence in your ability to get it installed!

That said and done, all I’m going to teach you is how to use it with no flags or anything of the sort. Yup… I wrote all this just to show you a single use type of ncdu.

Basically, for the exercise today, all you need to do is change to the directory you’re curious about and then you’ll just run ncdu in that directory. So, as you just opened your terminal and installed ncdu, you can just run it right there in your /home/<user> directory. It looks like this:

If you want to run it on the root of your drive, just navigate to it and run ncdu all over again. Sure, you can specify the directory or you can just be a lazy bum and navigate to the directory and simply run ncdu without any flags at all.

If you run it in your home directory, it’ll just be the files that belong to you. But, you can navigate to any directory and just run the command. In your home folder, it might look a little something like this:

ncdu showing the directories in order of tile size.
See? It should be pretty self explanatory from here on out. Navigation is easy.

To navigate, you just use your arrow keys. Up and down to pick the directory, forward and backward to enter and exit the directories. For example, when I dig down into my VirtualBox virtual machines directory, I get a screen that’s even more informative. Like this:

ncdu showing the directories in order of tile size.
As you can see, you can dig down quite nicely and find the file sizes.

Anyhow, I’m sure you can figure this out. Use your arrow buttons and explore. Heck, go to the root directory and explore your system until you’re happy and content! Trust me on this one,  you have the capacity to figure this out.

Now, before I go, I’d be remiss in my duties if I didn’t strongly suggest you read the actual man page. There’s a whole lot more to this tool. Using it this way is kinda like using a hammer to bake cookies, or some other horrible analogy. But, it does work. It does give you the information you need. Best of all, it does it without any necessary complexity.

Closure:

And there it is! Yet another article is said and done. This one will show you how to use ncdu in the terminal to find large files. If you’re ever unable to use a GUI, this is an excellent tool to determine file sizes. You never know when you’ll need such a tool.

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 own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Ask A Good Support Question

This article will teach you how to ask a good support question. After all, if you want good support (and of course you do) then you really need to start with a good question. Good questions lead to good answers. Good questions help us help you.

Let’s be frank about this. Asking a good support question is actually a difficult thing  for some people to do. The folks who really need support are often the least-knowledgeable, which already places them at a pretty solid disadvantage. 

Really, it’s hard to ask good questions. In fact, the possible scope of things that would need to be covered in an article of this nature is so large that I’m really only going to be able to give you some general guidelines. I’ll do what I can to help, and remember that various sites may have different conventions, so you’ll have to take from this what you can.

This article is pretty long because it is not easy to ask a good support question. It’s okay, to be new at it. It’s okay to not know everything. But, if you want support, you’ll have to learn how to ask for it. Also, if you’ve been directed to this page, it just means that you could can use some pointers to help us help you.

With all that said and done… Let’s learn how to ask a good support question!

Ask A Good Support Question:

It should be noted that this article is written in a fairly generic manner. After all, I want to make sure it’s useful to as many people as possible. Because of this, I add: When in doubt, follow the local conventions. The support site you’re using may have their own definitions of normal and good. So, as they say, “When in Rome, do as the Romans did.”

Start with a good headline! 

Your headline should actually be a short description. Generic headlines don’t help and won’t attract people to your question. A good headline will inform and be accurate. A good headline will make people want to open the thread and read your question. A bad headline lessens interest and interaction.

Bad: “My computer doesn’t work.”
Good: “After my last update, my computer stops booting after the GRUB screen with a blinking cursor and a black screen.”

Put some effort into crafting your headline. Don’t make it click-bait; make it an accurate summary of the problem. Make it a simple, well-thought-out description of your problem and brief enough to fit as a headline.

But, before you even begin asking questions…

Use the search feature!

Before you post your question, search! Search, search, search! It’s your computer and your problem, you should be the one doing the most research. On top of that, many questions already have an answer. Every support site out there has a search function. Use it!

Don’t just use the forum’s search – use your favorite search engine. Don’t just do a quick search, keep searching. Make it past the first five or ten search results, and don’t expect your answer to be on the first link you clicked. You might have to do multiple searches, digging deeper into the problem. Not all problems are easily resolved.

Searching can be hard – especially if you don’t know the jargon or lack the information to know the correct keywords. So, find as much information as you can about your problem and use any error logs you can find. Even if your searching doesn’t give you the answer – it might give you enough information to help us help you.

Hint: If you start an application from the terminal, you might learn something from the text it outputs to the terminal.

Hint: If you want a nice GUI way to read your logs, I highly recommend using ksystemlog. It pulls in just a few dependencies and is a very handy tool to have in your toolbox.

Again, search and then search some more. If nothing else, you’ll have more information, which you can help us to help you. You’ll also learn things along the way. What’s not to love?

While you’re searching, make sure you also search the support site to make sure you put your question in the right sub-forum. The “General” category is not a catch-all, it’s where you put your question when there’s no better category. If your question is about the terminal, put it in the command line sub-forum. If your question is specific to Ubuntu, make sure you put it in the “Debian and derivatives” section, or the “Ubuntu” section if they have it. Use commonsense and put your question in the most appropriate section.

Make your post legible!

If you want help, once again, you have to help us help you. This article is written for more than one site in mind, so I need to be generic. The support forum you choose to use has formatting features – use them! Make use of the formatting to better explain your problem and to better identify the information you’re sharing.

Unless otherwise specified, the language is English. It’s not that we’re trying to be jerks, it’s that we don’t speak your language. Use the DeepL translator (or Google Translate if needed) and post your question in English (when you’re on English-speaking sites). More generic, use the language the forum uses. The translation onus is on you, and not on them.

Use code tags. Every single Linux support forum that I know of has the ability to wrap things in code tags. It will look a little like this:

[code]sudo apt update && sudo apt upgrade -y[/code]

Using the code tags where appropriate will properly format the code and make it legible to those who wish to help you. It makes it easier for us to actually see what’s going on. It gives clear line breaks, makes the text distinct, and helps us spot problems. 

Use paragraphs. Giant walls of text aren’t easy to read, nor are they fun to decipher. This is especially true when they’re interspersed with multiple problems and poorly formatted code snippets. Without paragraphs, you might as well be writing gibberish.

For the love of all that’s holy, stop taking screenshots of text! It’s text. Post it as text! When you post your output as text, we can highlight the important bits and search for them. We can edit it and send it back to you. We may know what bit of that text is important and not having to type it out based on a picture is much more efficient.

So, if it is at all possible, do not post text as images. It’s a pain in the butt to get the text during a boot error, so there are obvious exceptions when it’s approached by a reasonable person. But, seriously, try to avoid it. Some of us completely ignore questions that are hard to read or questions that use graphics when text is more appropriate.

Be complete and informative!

There’s almost no such thing as too much information. I mean, sure, you could possibly give us more information than we need, but that’s infinitely better than not enough information.

We not only need to know what distro you’re using, we also need to know what version you’re using. Then, we may also need to know what desktop environment you’re using. We need to know what major changes you’ve made to your system. In some cases, where appropriate, we will also need to know what software version it is you’re talking about. For all but the most basic of questions, we may need to know quite a bit of information.

Believe it or not, we don’t actually know every piece of software that has been written over the years. When necessary, you should provide a link to the software’s home page – so that we can learn about it and help you with it. We’ll maybe even need to know how you installed it, as there are often multiple routes to installation.

If it’s a hardware connection, telling us the model number of your computer isn’t actually enough information. Different models have entirely different configurations while keeping the same model number. We’ll need to know things like what CPU you have, what your GPU model number is, what you have for a sound card, what type of connection to the internet you have, how much RAM you have, and possibly more. A great tool for gathering that information is inxi. We use that tool often on my favorite support site, Linux.org.

Sometimes It’s Not A Problem:

Sometimes, it’s the expected behavior. Yes, your computer will slow down when you have a bunch of browser tabs open and leave them open for days. Yes, your computer will still boot slowly if it’s old and you’re using an OS with a heavy desktop environment while you have everything opening at boot. No, it’s not supposed to show asterisks (some distros do) when you type your password into the terminal.

Be patient and helpful!

Unless you’re paying for support, we’re all volunteers. We owe you nothing. Don’t treat us like paid support and don’t expect us to do the work for you. You’re expected to participate in us helping you. When we ask for follow-up information, provide it in a timely manner. Don’t ask for help unless you have time to follow-up and respond to requests for additional information. Civility and gratitude go a long ways. 

TIP: Limit your questions to one at a time, unless you’re absolutely certain that they’re related. We volunteers tend to specialize in a few areas, so mixing a bunch of questions into one post is just confusing and may lead to your problems remaining unresolved. 

Don’t cross-post.

Pick a forum, one support site, and ask your question there. Chances are good that we’re members of the other forums, so you’re going to get a lot of the same people helping you. Don’t ask the same question at multiple sites, ask at one site – which also makes it easier for the person who’s searching for the same question in the future. Asking at multiple sites is asking folks to duplicate work. It’s just lazy, uninspired, and rude to do so.

Finally!

This is just a general guide. As I told you at the start, asking a good support question isn’t easy. On top of it all, different forums will have different conventions. So, you should probably lurk at a forum before just jumping in. It’s probably a good idea to pick a forum at the same time you pick a distro. That way, they know who you are when you’re asking for their help and you’re already a member of the community before you’re asking for help.

Remember, if your post was resolved, mention it and thank the person that helped you solve it. If you resolve the post on your own, add a comment to let folks know you found the solution – and what the solution was. On the sites that allow it, be sure to edit your title to let folks know the problem has been solved. For example, you can add [Solved] to your original headline and let forum helpers (and people looking for solutions) know that the thread contains a solution.

Closure:

And there it is… I have updated and moved the article that’s meant to help people ask a good support question. Quite a lot of the article has changed, including formatting. In the next day or two, the old link will have a 301 redirect to this link. So, if you’re linking to the older version of this article, it will automatically shunt people over here to view this article about how to ask a good support question.

I’d like to think that this is a ‘living document’. As such, it will change in time. If you can think of worthy additions, please leave a comment below. If this has helped you, please feel free to let us know (in a comment) which section of the article was most helpful to you. Most importantly, I want it to serve as a link folks can use when they want to help folks ask a good support question. The older version of this article was quite beneficial in that way. I hope this one follows suit.

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 own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Updated:
02/12/2022 (added the [Solved] and Google translate.)
07/07/2022 (fixed a spelling error that has been there the whole time.)

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.