Show Disk Usage With ‘ncdu’

In today’s article, we’re going to learn how to show disk usage with ‘ncdu’. It’ll be a fun terminal exercise that lets you see your disk usage. I’d say this is on par with a beginner article, ’cause it’s just some simple terminal commands. So, do read on!

If you think ‘ncdu’ sounds familiar, it may be from a previous article. You should probably read the intro to that article, as it will save you some time and is reasonably informative.

How To: Find Large Files Using ‘ncdu’

We’ll be using that same tool, but we’ll be using it in a different manner. That article explains what ‘ncdu’ is. In short, it stands NCurses Disk Usage and it’s a handy enough tool. It describes itself as:

ncdu – NCurses Disk Usage

There are a few ways to use ‘ncdu’ and we’ll be using it to show disk usage in this article. Because you have that handy link up there, I’m going to skip some sections of this article.

Show Disk Usage With ‘ncdu’:

This article requires an open terminal, like many other articles on this site. 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.

First, you’re going to need to install ‘ncdu’. Rather than duplicate work, please visit this article. Scroll down and you’ll see how to install ‘ncdu’. 

See? All these previous articles sure make some future articles easier.

Anyhow, now that you have ‘ncdu’ installed, just navigate to the root directory run ‘ncdu’ from the there.

Depending on how much disk space you have attached to your system at the time, it could take a while to run. Let it run and eventually you’ll end up with a screen like this:

ncdu in action
Pretty basic looking, right? Well, look deeper.

As you can see, the first line is highlighted. Well, use the arrow keys to move up and down. Then, use the left and right arrow keys to move back and forth. To keep it simple, if you want to dig deeper, just navigate to the directory you’re curious about and run ‘ncdu’ in that directory.

Hmm… I probably should have timed it. I set ‘ncdu’ running on a desktop with a couple of internal disks and attached to an external disk with a whole lot of files on it. It’s like an 8 TB disk and the system is still trying to process that bad boy.

ncdu can take a long time to run...
It has been a while… It’s okay, I have faith, It’ll finish someday!

Anyhow, read the man page:

There’s more to be done with ‘ncdu’ when you want to explore disk usage. It can take a minute or ten to run, but the information is worth it.

Closure:

There you have it, a fairly short article that explains how to show disk usage with ‘ncdu’. It seemed like a good article to write and it was nice having already covered so much of it. That saves some time and I was a bit late in writing this one.

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.

A Little About The ‘echo’ Command

That’s right, in today’s article we’re going to learn a little about the ‘echo’ command. We’ll barely be scratching the surface of the ‘echo’ command. There are so many ways to use ‘echo’ that we simply can’t fit it all into an article. Do, read on!

So, what is ‘echo’? Well, basically, the ‘echo’ command is a command that tells the computer to output text – be it in the terminal or using standard output to add that text to a file. It’s useful for regular people, but you’ll find it’s most commonly used in things like bash scripting

That sort of thing, scripting, is outside the scope of this article – and probably beyond the scope of the entire site. Maybe I’ll get to it, but those would end up being long articles, or articles written in parts. Besides, I’m not really all that good with scripting. (If you are good with scripting and would like to write some articles, do let me know.)

This is how the man page describes the ‘echo’ command:

echo – display a line of text

That’s indeed what it does. When you combine it with things like variables, you open up a whole new world. I don’t actually have a very good article about variables, other than existing variables. I should probably have said article.

Anyhow, we’ll just be scratching the surface of the ‘echo’ command. There are all sorts of ways to use ‘echo’, but we’re just going to use it in ways that a new Linux user might use it. Some basic familiarity is probably a good thing.

The ‘echo’ Command:

This article requires an open terminal. 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. Otherwise, just open your terminal like you normally would.

So, how you start with this ‘echo’ command:

You can also add quotes, and in some cases probably should:

You can also use the > operand and echo the text to a file. Like so:

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

However, that’s not all you can do with the ‘echo’ command. You can also automatically fill in the information by way of environment variables. For example, try this:

Or you can try:

Read: How To: Show All Environment Variables

See? It’s good that I’ve written so many articles. I get to refer to ’em and save us all a bunch of time. So, be sure to visit those articles – especially if you’re a new user. If you’ve forgotten something, you can ‘echo’ the variable to be reminded.

Bonus:

This next bit is really just some information you’re gonna need down the road. I can sense it! This is a bit advanced for some of you, and you won’t need this until later in your Linux journey, but others will see this and suddenly understand the potential. If you’re new, you’ll get there.

The first thing we’re going to do is set a variable. It’s actually very easy to set your own variables in Linux. In this case, we’ll use:

Now, let’s just ‘echo’ the variable you just created:

Or, even better, you can then try:

See? It will output the variable when you echo it. You can create all the variables you’ll realistically ever need. 

You can actually format the output from the ‘echo’ command. For example, the -e flag with the \n separator. An example command looks like:

You can format the text in a variety of ways, just read the man page. You can do quite a lot with the ‘echo’ command and you should definitely check the man page if you’re interested in exploring all the possibilities:

There’s a ton of ways to use ‘echo’ (and with it variables) for those with a clever mind. When you do move on to learn about scripting, you’ll learn that it’s a basic tool used for all sorts of things, in all sorts of clever ways.

Closure:

And there you have it. You have a new article. This time, we’ve covered just the slightest bit of the ‘echo’ command. It’s enough to get your mind working, or so I hope. It’s enough to get a slight taste of the potential and to understand why you may want to be familiar with 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 own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Fix The Application Menu For Shutter

Today’s article is pretty niche, one where we fix the application menu for Shutter. On one hand, if you don’t use Shutter, this probably isn’t the article for you – but you can still read it and learn something useful. On the other hand, it fixes a ‘problem’ with Shutter and I think this is a fine time to cover it.

So, if you use Shutter, read on! (Hint: Even if you don’t personally use Shutter, you can still benefit from this article.) You’ll just need to understand what was done and how to apply it to other shortcuts.

By the way, Shutter has been mentioned here (and elsewhere):

Take, Edit, And Upload Screenshots With Shutter

I use Shutter all the time. It’s my go-to when I need to share a screenshot. It’s handy and I recommend it to anyone who has to deal with a lot of screenshots. I also use Flameshot, but that’s less often.

Alas, when you install Shutter it wants to put the application menu shortcut under something like ‘Utility’, so it appears as an administration tool or doesn’t show up where you’d expect it to be. This is just silliness.

What Shutter should do is should show up under ‘Graphics’ in the application sub-menu! So, that’s what this article will do. It will show you how to fix the application menu for Shutter so that it shows up under ‘Graphics’.

This article shouldn’t be all that long. It seems to me that it should be pretty brief… We’ll just have to wait and see!

Also, as mentioned above, this article should be easy enough for my readers to extrapolate into resolving other application menu gaffes/choices. It’s a nice and easy article. Or at least I hope it is…

Fix The Application Menu For Shutter:

Now, when I did this, I did it with the GUI. You will not be doing it in the GUI, if you follow this article’s advice. When you do it graphically, it’s still pretty simple. It looks something like this:

You can use a GUI to change where the file is listed in the application menu.
Fixing the application menu to show Shutter under the ‘graphics’ heading.

That’d be a bit convoluted to explain because everyone’s using a different desktop environment and different file managers. So, instead of doing this is a GUI, we’re doing to do this in the terminal. (Of course we are.)

Open your default terminal now. If you don’t actually know how to, you can just press CTRL + ALT + T and your default terminal should open.

With your terminal now open, enter the following command:

That will open the .desktop file with Nano.

From there, scroll down to where you see “Categories” and change the ‘Utilities’ to ‘Graphics’. With that done, you need to save your changes. As we’re using Nano, you save your changes by just pressing CTRL + X, then Y, and then ENTER

The results should be immediate, though I’ve seen this require logging out and back in again. For the most part, it should just work – and it should work immediately. When you next open the application menu, you should find Shutter where it belongs – under the ‘Graphics’ sub-menu.

Now, you can do this with all sorts of other applications. If you don’t like the existing category, just change it until you do like the category. When you change that, the shortcut should appear in the expected sub-menu.

Feel free to try this will all the applications you want. It should work with any of them. If you do decide to do this in a GUI, you’ll need root and the files need to be edited as though they’re plain text. Enjoy!

Closure:

And there you have it… You have another article. In this article, you’ll have learned how to fix the application menu for Shutter – and other applications. Best of all, you’ll have done it in the terminal, which means you can do this with pretty much every operating system without needing to change the commands. The terminal is pretty 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 own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

A Little About The ‘lspci’ Command

Today’s article is going to be another article where we get back to the basics, where we’ll learn a little about the ‘lspci’ command. As far as articles go, this one should be both fairly brief and easy to understand. To learn more about the ‘lspci’ command, read on! 

I am going to be writing some articles that cover the basics. I decided to not write them all at once, but to intersperse them with other articles. So far, we’ve had:

A Little About The ‘lsusb’ Command
A Little About The ‘lscpu’ Command

Well, this time around we’re going to cover ‘lspci’. 

So, what is ‘lspci’? We can find no better source than the man pages, which helpfully describe ‘lspci’ as:

lspci – list all PCI devices

Well, we see that it lists PCI devices, but what are those? PCI is another way hardware components talk with the CPU. If you have a fancy graphics card, it’s probably PCI-based (but likely PCI-X). If you’re really curious, PCI stands for “Peripheral Component Interconnect” but think of it as a way hardware can talk to the central processing unit.

So, the ‘lspci’ command will list things attached to the computer on the PCI bus. This is remarkably similar to the ‘lsusb’ command, though PCI can have a USB device attached to it through a hub.

Anyhow, that’s what PCI is and that’s what ‘lspci’ is meant to do. So, with that in mind, let’s just belly-flop into the article!

The ‘lspci’ Command:

You’ll find that ‘lspci’ is a terminal-based command. As such, you’ll have to have a terminal window open. If you don’t know how to open your default terminal emulator, just press CTRL + ALT + T and your default terminal should open.

We will not be covering everything that can be done with the ‘lspci’ command. We might have time and space (this time around), there’s really no reason to dive deeper into the ‘lspci’ command. We’re just going to cover the basics – because that’s all you’ll realistically have to worry about.

With your terminal now open, just run the command with no flags (but with sudo, ’cause ‘lspci’ wants elevated permissions to operate):

If you want a more verbose output, you can do that. Your choices are -v, -vv, and -vvv with ever-increasing amounts of verbosity. That can be pretty handy. Try this command to experience the most verbose output:

Where you might find the ‘lspci’ command most useful would be when you already know the class and category of information you want returned. When you use ‘lspci’ with ‘grep’, it gets more useful. For example, to learn about your memory:

See? It’s pretty straightforward. You’ll get this. I’m sure of it! (See 2nd edit below.)

As you can see, there’s quite a bit that you can do with the ‘lspci’ command. It’s a pretty handy command and we’ve just covered the ways you’re most likely to use ‘lspci’. 

EDIT: Fixed some information. I had somehow started to include lshw commands.
EDIT: So, this article was horribly written. Now it’s just short. I conflated ‘lspci’ with ‘lshw’ somehow – probably ’cause they’re next to each other in my notes. I’m just going to leave it as it is now.

Closure:

There it is, another new article! This time, we’re learning a little about the ‘lspci’ command. It’s a handy command to have learned, as you’ll eventually want to know about the hardware using the PCI bus. When that day does come, you’ll be able to use the command. Also, I’m ahead of schedule with pre-written articles.

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.

A Little About The ‘lscpu’ Command

In today’s article we’re going to do what the title says, we’re going to learn a little about the ‘lscpu’ command. We’ll just touch the ways you’re likely to use ‘lscpu’ and that’s it. Then again, there’s not much more to it than that, so it’s going to be easy enough for a new Linux user to understand. You’re invited to read on…

As mentioned in the last article, and in the article before that, I’m going to take some time to cover some of the basic commands. However, I’m going to try to intersperse them, that is mix them up a bit, so that it’s not too boring for myself and my regular readers who are beyond this level.

The first of these articles was:

A Little About The ‘lsusb’ Command.

This article will cover ‘lscpu’. If it’s not obvious, this command will list information about your CPU. In fact, the man page describes ‘lscpu’ like:

lscpu – display information about the CPU architecture

And, sure enough, that’s the information we’re after in this article.

Of course, this is another command that gets run in the terminal. It’s an application that comes with ‘util-linux’ and is something you shouldn’t need to install. You should be able to use the ‘lscpu’ command without installing anything. So, there’s that…

Rather than drag the intro out, let’s just jump into it…

About The ‘lscpu’ Command:

As I mentioned in the intro, ‘lscpu’ is a terminal command. Of course, this means you need an open terminal. You should open one now. If you don’t know how to open your terminal, just press CTRL + ALT + T and your default terminal should open.

With your terminal now open, simply run the ‘lscpu’ command:

Tada! You have all the information you really need to know about your CPU – and quite a bit more information. So, let’s see what else we can do with the ‘lscpu’ command.

Let’s say you want some extended information. You can go about that with the -e flag. That’s easy enough to do, a simple command. It looks like this:

The outcome from that command would probably look a bit like:

the output of lscpu
As you can see, this CPU isn’t anything all that fancy. It’s effective and efficient!

As you can see, there’s nothing too fancy there.

You can actually select the fields you want to output from that command. For example, you can see the CPU and the CORE fields like this:

The only other way you’re going to use ‘lscpu’ is likely to be with grep. For example, if you want to know what architecture your CPU supports, you can run this command:

There’s more to ‘lscpu’, but you’re not likely to really need it for anything. If you do need more from ‘lscpu’, you just check the man page like so:

The man page should help you with anything more than what’s covered in this article. There’s not all that much more that’s useful, we’ve at least examined the ‘lscpu’ command.

Closure:

Yup, there’s another article. This article does what it attempted to do – which is share the most useful ways to use the ‘lscpu’. If you find yourself in a position where you need fairly detailed CPU commands, then ‘lscpu’ is the command you’re looking for.

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.

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.