View Disk Usage

This article might seem like it has been written before but this is an entirely new way to view disk usage. To write this article I had to write two other articles. Tell me that that doesn’t sound like fun!

So, let’s see here… And, yes, I’m aware that they’re not disks anymore.

Yup. It’s official. There are too many ways to view disk usage in Linux – especially in the terminal. Why am I writing yet another article on the subject of disk usage? Because I can! I love showing how there are many ways to do the same thing in Linux. This is great because you can pick and use your favorite methods.

As for the subject of monitoring disk usage…

Monitor Disk Usage With GDU
Show Disk Usage With ‘ncdu’
A Few Ways To Visualize Disk Usage In Linux
How To: Check Disk Usage With ‘df’
Yet Another Way To Check Filesystem Space Use

Those are just the first five links when I searched for ‘disk usage’. That’s just five ways to check disk usage in Linux. I’m willing to bet that we can easily come up with five more ways to do this.

What’s special about this way of viewing disk usage?

Well, today we’ll be monitoring your drive space with a tool written in Python. You’ll need to enable PIP, a Python packaging tool. Once you’ve done that, this is universal. It will work in any distro that supports PIP – which, as you’ll see, is just about every major distro on the planet.

Read the following before going further:

Install Python’s PIP Part One
Install Python’s PIP Part Two

If you haven’t already installed Python’s PIP, this article will be of no use to you. You’ll need PIP enabled to proceed. You should also add the $PATH as defined in the second article. From here on out, the article will assume you’ve done both of those things.

View Disk Usage With Vizex:

The tool we’ll be using is known as Vizex. You can see the Vizex project page here. If you bother going there, you’ll see that Vizex is indeed the correct tool for the job. You’ll see that this is (one of the many) correct tools for the job.

vizex is the terminal program for the UNIX/Linux systems which helps the user to visualize the disk space usage for every partition and media on the user’s machine. vizex is highly customizable and can fit any user’s taste and preferences.

Hmm… It is at this point that I noticed that they don’t capitalize it. I’m going to capitalize it because it’s keeping the system from saying I didn’t spell it properly. 

Anyhow, as you’re using PIP, you’ll need an open terminal. You can use your GUI to open your terminal. On many systems, just press CTRL + ALT + T and your default terminal will open.

To install Vizex, run the following command:

If you’ve never installed a Python package with PIP before, then be sure to keep an eye on the screen. It’s a fascinating process and watching stuff happen in the terminal is pretty sweet!

Now that you have Vizex installed, you simply run that command in the terminal. If you didn’t follow the 2nd part of the Python PIP article you’ll have to specify the path. That’s just silly. Follow the 2nd article (it’s really easy) and you don’t have to deal with that. 

Using Vizex:

Anyhow, that command is simply:

It will even color-code your drives. If they’re close to full, they’ll be red and blink (missed in the screenshot below). If you’re moderately full, they’ll be listed in the yellow. I wanted to use Vizex to view a computer will all sorts of drives, so I did! That’s how you ended up with this screenshot:

using vizex to view disk usage
If this isn’t self-explanatory, I don’t know what is! It’s so simple that I can figure it out!

If that isn’t one of the easiest ways to view disk usage, I don’t know what is. This is just one of the many reasons why you should have Python’s PIP installed. There’s a bunch of software that’s available if you just know where to look. It took a while, but I finally got around to sharing this information. In my defense, it did take a couple of articles to share it properly.

Closure:

There are all sorts of ways to view disk usage. This is just another way, though it’s an interesting way. I’m quite sure that I’ll cover this very same subject again in another article. For now, I’ve covered a way to do so with Python and that’s something different than you’ve previously seen on the site.

I may not place ads on the site and just opt to accept sponsored articles as a way to cover the bills. That seems like a good thing to do. Some stuff may already be in the works, so look for that in the future. If you’re interested in sponsoring an article, be sure to hit me up. We get good traffic and rank well in the search engines. So, get some extra traffic and some SEO benefits by sponsoring an 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.

Mastering Efficiency: Unleashing the Power of Bash Aliases

In the realm of command-line prowess, efficiency is king, such as Bash aliases. Every keystroke saved is a victory, and every shortcut mastered is a step toward domination over the terminal.

Among the arsenal of tools at your disposal, one weapon stands out as a champion of efficiency: Bash aliases. These humble shortcuts can transform your command-line experience from mundane to magnificent, allowing you to wield the power of complex commands with the simplicity of a single word.

Join us on a journey as we delve into the world of Bash aliases and unlock their full potential.

What are Bash Aliases?

Bash aliases are custom shortcuts or abbreviations that you can create to simplify and speed up your command-line tasks. They allow you to define your own commands or override existing ones with your preferred options or parameters.

Think of them as your personal command-line assistant, ready to execute your commands at a moment’s notice.

Why Use Bash Aliases?

The benefits of Bash aliases are manifold:

  1. Speed: With aliases, you can execute complex commands with just a few keystrokes, saving valuable time and effort.

  2. Simplicity: Long and convoluted commands can be distilled into concise aliases, making your command-line interactions more intuitive and less error-prone.

  3. Customization: Aliases are highly customizable, allowing you to tailor your command-line environment to suit your specific needs and preferences.

  4. Productivity: By automating repetitive tasks, aliases can significantly boost your productivity and streamline your workflow.

How to Create Bash Aliases

Creating Bash aliases is a breeze. Open your .bashrc  file, located in your home directory, using your favorite text editor (such as Nano). Then, add your alias definitions to the file using the following syntax:

Replace shortcut with the alias you want to create and command with the command you want to associate with the alias. For example:

This alias allows you to list all files in the current directory in a long listing format with file details.

Once you’ve added your aliases, save the .bashrc file and either restart your terminal or run source ~/.bashrc to apply the changes.

Examples of Useful Bash Aliases

Here are some examples of useful Bash aliases to get you started:

Best Practices for Bash Aliases

To make the most of Bash aliases, keep the following best practices in mind:

  1. Choose meaningful names: Use descriptive names for your aliases to make them easy to remember and understand.

  2. Avoid overriding existing commands: Be cautious when overriding existing commands with aliases to prevent confusion and unintended consequences.

  3. Document your aliases: Consider adding comments to your .bashrc  file to document your aliases and their purposes for future reference.

  4. Stay organized: Group related aliases together and organize them logically within your .bashrc  file for easier management.

Conclusion

In the fast-paced world of the command line, efficiency reigns supreme. Bash aliases empower you to wield the full power of the terminal with unparalleled speed and simplicity.

By mastering the art of aliases, you can elevate your command-line prowess to new heights and easily conquer even the most daunting tasks. So go forth, fellow command-line warriors, and unleash the power of Bash aliases upon the digital realm!

Can you tell that this was written by AI? The prompt I used for this was:

Write an article about Bash Aliases in the style of linux-tips.us.

It didn’t do very well at nailing my style and it used a lot of headers. It also rambled on quite a bit, but I do that too. I’m not sure how much time this saved. I still had to do quite a bit of formatting. A simple cut-and-paste would not match the mostly consistent formatting I have used as of late. That meant quite a bit of formatting.

I also ran the article through Grammarly. It’s too bad that they won’t accept me into the affiliate program. I quite like what they do for my writing. They make me look almost literate!

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.

Install Python’s PIP Part Two

This article may also seem a bit unusual because I covered how to install Python’s PIP in the last article. This article is the second part of that. This is something that seemed like it should be two articles, so it is two articles.

Additionally, I share this information so that I can write future articles. So, by themselves, these two articles won’t accomplish much by themselves. They will come in handy for future reference and that’s the point of this.

In the previous article about how to install Python’s PIP, you learned the basics. In that article, you learned how to install PIP. That’s all well and good, but then you might be confused when you go to install a package installed by PIP.

During the package installation, you may see a warning that looks like this:

This is because PIP installs the packages somewhere like your ~/local/.bin directory. If you then try to run the package from the terminal, it won’t be found. 

For the record, this is for people using Bash. I’m not sure about other shells.

You can still use PIP packages just fine, you just have to specify the path. That’s a pain in the butt and not something you should have to do. Instead, we’re going to add the path as suggested. If you’ve done that, you can just type the package name into the terminal to run your PIP-installed Python applications.

So, let’s do that…

Install Python’s PIP Part Two:

By now it should be obvious that this requires an open terminal. You did read the first article, right? As such, you can usually open your terminal with your keyboard, simply press CTRL + ALT + T, and your default terminal should open.

With your terminal open, we need to add some text to your ~/.bashrc file that sets the path. It’s pretty straightforward and we’ll be using Nano for this. Click that link if you’re not sure if you have Nano installed.

Let’s open the file for editing with this command:

Then scroll to the bottom.

At the bottom, add a new line.

Copy and paste the following:

Next, we save the changes and exit Nano by pressing CTRL + X, then Y, and then ENTER on your keyboard.

No changes will have been made just yet. You could reboot or reload your desktop session if you wanted, but you can tell the shell to reload the file and thus have the changes take effect. To do that, you’d enter this:

At that point, you can install PIP packages and have them run when you just type the command into the terminal. There’s no need to add anything else to the command. This sets the path that PIP was complaining about.

And now you’re ready to install Python PIP packages. This is an important step after you install Python’s PIP. It should serve you well, assuming you want Python packages installed in a pretty simple manner.

IMPORTANT: Read Part 1 to install Python’s PIP.

Closure:

As you can tell by the length, there’s a reason that this is a second article. I’ll have to remember to edit the first article when this article gets published. It’s not that it’s complicated, it’s just long.

So, it seemed best to turn this into a second article – especially because it’s not technically a necessary step. You can comfortably run Python packages by using the file path, but this is much easier.

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 Recently Modified Files

Over the past couple of years, I’ve done a lot of articles about file management; this one will help you find recently modified files. There’s nothing too complicated about this, so most of my readers should be able to follow along.

There are a number of reasons to find recently modified files. Perhaps you need to assess a file system that shouldn’t have been altered. You may need to do so for some accountability process. Then again, you could want to check a system to see what’s changing and eating up your disk space.

You might want to find recently modified files for all sorts of reasons. Heck, you might have forgotten where you placed a file but recall that you did so within the past 48 hours. This can help you narrow down your search, helping you find the file more quickly.

Of course, this will be in the terminal. That’s how we do things around here. This will also be portable. You need only the find command and you’ll certainly have that available by default.

The find Command:

As I said, you’ll need the find command. This will be installed by default. You can verify that find is available with this command:

The output should match this:

Next, you’ll want to check the man page (with man find) which will show you that this is the correct tool for the job. Notably, it says this:

find – search for files in a directory hierarchy

Yup. That’s what we want to do. 

The find command is very capable and will seem complicated to the newer Linux users. It may even push some more advanced users away. I aim to make Linux approachable, so we’ll only be worried about a couple of flags.

The type Flag:

The first flag we’ll be using is the type flag. If you check the man page, you’ll see that there are many types. We’ll specify f which signifies we wish to find regular files.

The newermt Flag:

While you’re on the man page you will see references to newer but nothing specific about newermt. It’s a reference to time. Specifically, it means less than or equal to. For example, a file that’s one day old will be listed in the results if you ask for files one day old or newer. That’s what we’ll be doing in this article.

Find Recently Modified Files:

While you will find that you have the find command available in any distro I can think of, you’ll also need to know that this is an exercise that requires the terminal. There are GUI options out there, but we’ll be using the terminal. So, press CTRL + ALT + T and let’s get started!

The syntax of the command would be this:

In our case, we’re going to use the ~/Downloads directory in our examples.

The "time frame" is where things get interesting. For the find command, you can almost use plain English. The command understands seconds, minutes, hours, days, weeks, months, and years.

Let’s say you want to scan your Downloads directory for files that you have added within the past four weeks. Well, simply use this command:

If you want to search for files within the past three months, use this command:

In the case of that command, it will find any files newer than (or equal to) three months of age. It’s a very simple command to use once you understand the syntax.

You do have to use numbers. 

If you want to quickly test this, try the following:

You could have even specified that in seconds:

You can also put dates in there.

Let’s say you want to find files newer than February 1st, 2024. You can do that. If you live in the US, you might have to use a date format that you’re not used to. So, the basic syntax would be:

Or, for today’s exercise:

I’m not sure if it’s possible to tell it to use the US date formatting. I was unable to make that work in the two attempts I made at it. Let’s just say that I didn’t invest a whole lot of energy.

There’s a lot more to the find command, but this is one way to use it. The goal is small bites that help make Linux more acceptable. Even I can be overwhelmed and I’ve been doing this for years.

Closure:

Well, if you’ve ever wanted to find recently modified files, you now have the tools to do so. While there’s a lot to this command, it’s possible to use the command without being fully versed in the matter. You don’t have to know everything to take advantage of the tools. Just like you don’t have to be a carpenter to know how to swing a hammer well enough to seat a nail.

Hmm… This article isn’t even all that long!

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 Running Processes

Your Linux system will have a lot of things running and these things have their own process, so let’s learn how to show running processes in the Linux terminal. This is something that’s a bit more advanced than most regular desktop users will need, but it’s still worth knowing.

You may not realize it, but you have a whole lot of processes running. These processes are what makes your system work. Without them, you’d have no activity. There’s a lot you could learn about processes, such as how they’re not all owned by your user account and how they all have their own process identification number (known as a PID).

None of those things are important for today’s article.

Today, we’re just going to show running processes in the terminal. It’s not a very complicated thing – and I’ll show you a couple of things you can do with this exercise.

You won’t need to install anything. We’ll be using the ps command that is almost certainly installed by default.

The ps Command:

The ps command is exactly the tool we want to use. It’s used to show running processes, the goal of this very article. You can verify that ps is available (and it is, it has been around since the UNIX days as I recall) with this command:

If you check the man page, you’ll confirm that this is the right tool for the job:

ps – report a snapshot of the current processes.

This is pretty self-explanatory. We’ll be using that very command to show running processes on your Linux box. Well, I suppose this would also be valid for the other *NIX OSes, like BSD and probably MacOS. I don’t use those OSes, so I can’t confirm the availability of the ps command – but it’s pretty likely to be there and perform the same task.

Show Running Processes:

As I mentioned above, you’ll need an open terminal for this exercise. You can open your terminal from your application menu. You can usually just press CTRL + ALT + T and your terminal will open.

The ps command reads the files in the /proc directory and doesn’t need elevated permissions to run. Some of the processes will not be owned by you, so acting on this information may require elevated permissions.

With your terminal open, simply run the ps command in the terminal:

As you can see, that’s not a lot of running processes. It doesn’t show them all.

If you want to see all the running processes:

Or, if you want to really use the ps command to get a lot of information:

Now, you don’t always want that much information at once, so try this:

There are times when you’ll want to use the ps command for a purpose, such as finding the PID of an application that’s frozen. To do that, you can pipe it to grep and limit the output. For example:

There’s a lot more to the ps command, so check man ps for more information. This is just scratching the surface.

Closure:

Well, this ended up shorter than I expected. I don’t want to dive in too deep. The goal is just a quick overview, but I expected it to take longer to describe this stuff. Fortunately, it’s a fairly easy subject – on the surface. Dig into the man page and you’ll see there’s quite a bit more that you can do.

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.