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 ‘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.

Control Your WiFi With ‘rfkill’ And More

In today’s article, we’re going to learn how to control your WiFi with ‘rfkill’ and we’ll be learning a bit more than that. I think you’ll find ‘rfkill’ to be a nifty and useful terminal-based command to learn. Is this article appropriate for a beginner? Maybe? Maybe not? I’ll do my best to make it approachable for anyone at any level.

By the way, I’ve decided to intersperse the articles about simple commands like ‘lsusb’. I don’t want to bore my more advanced readers – and I don’t want to bore myself. I’ve decided to make the time necessary, even though I’m pretty busy. I’ll be busy for a little more than a week. (Ask me in private, if you want.)

Anyhow, you should learn about ‘rfkill’, as it’s a pretty handy tool for controlling your wireless. If you look at the name, there should be some indication that it’s actually more than just WiFi. You can use ‘rfkill’ to manage Bluetooth, for example. Bluetooth is also wireless communication. As such, you can use ‘rfkill’ to manage that as well.

So, what is ‘rfkill’? Let’s see how the man page defines it:

rfkill – tool for enabling and disabling wireless devices

See? It says what you’d expect, assuming you read the previous paragraph. The title only mentions WiFi, but that’s really due to space and convenience. You can use ‘rfkill’ to manage both WiFi and Bluetooth. Pretty handy, huh?

Well then, let’s just get the party started…

Control Your WiFi with ‘rfkill’:

Sure enough, you use ‘rfkill’ in the terminal. On Linux-Tips.us, we do a whole lot of stuff in the terminal. So, open your terminal now. If you don’t know how to open your terminal, just press CTRL + ALT + T and your terminal should just pop open.

With your terminal now open, let’s first gather some information:

The output should look a little bit like this, or a lot like this:

gathering information with rfkill
The output should be fairly easy to understand for my delightful readers! I have faith in you!

The information you’re after “ID,TYPE-DESC,SOFT,HARD” is easy to understand. 

The first column is the ID number and the second column is a description of the device. The third column is if there’s a ‘soft block’ on the device, and the fourth column is if there’s a ‘hard block’ on the device.

If you see a ‘soft block’, that’s when there’s some software that disabled the device. A ‘hard block’ is when there’s a hardware block on the device. If it is soft blocked, you’ll need a software solution to turn it on – like ‘rfkill’.

Additionally, when you see a ‘hard block’, it means there’s probably a physical switch (often an Fn + F* key combination, perhaps labeled something like ‘Airplane Mode’) that is keeping the device powered off. You need to physically enable the device to make it work.

Importantly, the ‘rfkill’ application can do nothing about a hard block. But, it can do something about a soft block. If you want to unblock WiFi, try this:

Using my computer’s output, to unblock the WiFi the command would be:

You can also unblock with the description. To unblock the WiFi with the description looks like:

Of course,  you can also do the opposite. Instead of ‘unblock’ you would use ‘block’. That means the opposite of the above command would be:

If you want, you can also just ‘toggle’ the devices. When you toggle it, it turns off if it was on – and it turns on if it was off. You do that with the ID. If I wanted to toggle the wireless, the command would look like:

That will turn my WiFi off (if it was on) or it will turn my WiFi on (if it was currently turned off). See? It’s pretty simple!

Well, I hope I’ve made it simple. If it’s not simple, I hope it’s at least approachable. Like always, feel free to drop a question as a comment. If I don’t have an answer, I’ll try to direct you to someone who does.

Also, don’t be afraid of the man page. There’s a lot more to ‘rfkill’ than I’ve covered in this article. We’ve mostly just scratched the surface. To check the man page:

That’ll give you all the information you want. Plus, I’m sure others have authored pages that will go into more depth. We tend to not do too much of that here. I just want you to be up and running, not Linux gurus. If you want to be a Linux guru, you’ll need a whole lot more than just this site!

Closure:

Well, I’m glad you made it through today’s article. I tried to keep it nice and simple, simply showing you a way to control your WiFi with ‘rfkill’. But, there’s more to it, including Bluetooth. I like to think I’ve made this approachable for even a new user, but maybe not…

Again, feel free to comment about this. Is it easy enough for a new person? How about a new person coming from a Google search? Is it easy enough for a novice, someone completely new to computers? (Probably not, but 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 own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

A Little About The ‘lsusb’ Command.

Today’s article will not be all that long or all that complicated, as we’ll just be learning a little about the ‘lsusb’ command. It seems like a good idea to cover it now, early in the year. I’ve been meaning to get to writing this article for a while.

Over the next few days, you will probably see some similar-looking articles. This is just the start. There are other similar commands and we’re going to cover those. Many of my readers will know some (or all) about these commands, and that’s okay. After all, our goal is getting people up to speed.

Today’s command will be the ‘lsusb’ command. If you check the man page, it’s described accurately – like so:

lsusb – list USB devices

As you can see, you use the ‘lsusb’ command when you want to learn about your system’s USB buses and the devices connected to them. You shouldn’t need to install anything. The ‘lsusb’ application is almost certainly available by default.

We probably won’t be covering all the ‘lsusb’ options. We’re just going to cover those options that you’re most likely to use. There’s always the man page for when you want more options. There’s really no need to get to deep in an article like this.

About The ‘lsusb’ Command:

The ‘lsusb’ command is a command that’s run only in the terminal. So, of course, you’ll need to have an open terminal available. If you just press CTRL + ALT + T and your default terminal should open. Tada! It’s pure witchcraft!

With your terminal now open, the simplest form of ‘lsusb’ is to just run the command without any flags. Like so:

You’ll likely get an output similar to this:

output from the 'lsusb' command
This is just the ‘lsusb’ output from a handy laptop. It’s pretty basic, with nothing connected.

As you can see, it’s not always just the actual USB ports on the side of your device that are USB devices. In the above screenshot, you can see that the wireless card, webcam, and Bluetooth devices are all on the USB bus. They’re not actually connected to a physical USB port, they’re just using the same underlying tech without actually having physical ports.

There are other things you can do with ‘lsusb’, like view the output in tree format. This is great if you’ve got things like USB hubs with things attached to them. It’s good organization and the command is simply:

The only other ‘lsusb’ command you’re likely to use is the ‘verbose’ mode. Like oh so many other applications, that’s the -v flag. The command looks like:

This is not to be confused with lsusb -V – which will show you the version. If you do that, you’ll also learn that the ‘lsusb’ command is a part of the ‘usbutils’ package. 

There’s not all that much more to the ‘lsusb’ command. Those are the ‘lsusb’ commands I’ve found myself using more than any others. They’re also the most used commands I’d ask a user to run when diagnosing a problem with their USB devices. If you want, you can learn more by checking the man page:

There’s more information in the man page about running the ‘lsusb’ command. Feel free to check it out and ask any questions needed.

Closure:

I’m going to cover some pretty basic stuff in the next few articles. I may intersperse them with other articles, so that folks don’t get bored. Don’t be bashful, leave a comment or two if you want. I love getting new comments and the site’s starting to grow quite nicely. Get your comments in early!

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.

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