Generate A Process Tree

This shouldn’t be a very long (or complicated) article as we’re simply going to cover one way to generate a process tree. This is more useful than it may sound, especially in process management.

We’ll be doing this in distros that support apt. So, that’d be distros like Debian, Ubuntu, Linux Mint, Elementary, and many others. That’s distros within the Debian family. That’s a good chunk of the available distros, so this will apply to many of you.

It’s not that this won’t work on other distros. It’s that I haven’t tested this on other distros. You can likely follow along and figure it out with your package manager, I’ve just not done so. I do have a limited amount of time and the only human resource I have is myself. Man, I could use an editor!

For the record, this seems like something you’ll find installed by default on any major system. You may not need to install anything at all. This might just be already available.

Anyhow… About processes…

Everything running on Linux is a process. There are a whole lot of processes that make up a running system. For the most part, you can ignore all this and keep computing. However, when you troubleshoot a system you may be interested in which processes are running. If you’re recovering from a slow system, you may be interested in killing processes.

One process may spawn other processes. For example, you may have a browser with open tabs. The browser is itself one process. The open tabs may be separate processes. This is a good thing for things like compartmentalization and even security, but that’s outside of the scope of this article.

So, what tools will we be using?

psmisc:

I believe the correct term for psmisc is that it’s a meta-package. That is, psmisc is a package that contains some other tools. If you want to follow along with this article, that’s the package you’ll likely want to install. I’ll cover installing it with apt, which is nice.

If you’re interested in psmisc, here’s the psmisc project page. The package includes the following applications:

  • fuser – Identifies processes using files or sockets
  • killall – kills processes by name, e.g. killall -HUP named
  • prtstat – prints statistics of a process
  • pslog – prints log path(s) of a process
  • pstree – shows the currently running processes as a tree
  • peekfd – shows the data travelling [sic] over a file descriptor

Of these, we’re interested in ‘pstree’. We have mentioned the killall command before and chances are that you won’t need to install anything for this at all. I did mention that above…

pstree:

This is the tool we’ll be using to generate a process tree. It comes with the above package and is one of those tools I think is likely available by default. I’ll cover how to use apt to install it below, but it seems like one of those things that you’re going to find on other distros. You’ll likely find that it’s installed by default on all those distros.

You can verify that you have this available with the following command:

The output should match this:

Don’t worry if that’s not available, we’ll install it below.

If you want to generate a process tree, you’ll see that the man page confirms that this is a good tool to do so, though the name should have clued you in. To read the man page, just run this command:

See? It’s not all that involved. It’s a pretty simple application.

Generate A Process Tree:

To generate a process tree in Linux, you’ll need an open terminal. Well, if you’re going to use pstree to generate a process tree in Linux, you will need an open terminal. Most of you can just open a terminal by pressing CTRL + ALT + T on your keyboard.

With your terminal open, let’s make sure that you have installed psmisc.

Now that you have psmisc installed, you can use the pstree command. Don’t blame me for this, I didn’t do it. 

You can simply run the command as it stands:

However, I previously wrote this article:

How To: Kill Processes By Their PID (Process ID)

I want to tie into that article. You can use the pstree command, which is a nice and easily understood output, to show the PID. That command would look like this command:

However, there’s a more useful command for those dealing with sudden issues. You can use a flag known as --color=age to get an idea about how new the processes are.

Green would be within the past 60 seconds, yellow would be within the past hour – or so I’m told. Every time I try, it shows up red. You can try it if you want, like so:

Good luck with that one! Seriously… Good luck!

Even if that doesn’t work, you can now generate a process tree to show the running processes on your system. This seems like a good thing to know.

Closure:

I was recently asked if I was running out of ideas for articles and the answer I gave them was that I am not. There’s always something to write about, even if it’s just a simple task like generating a process tree. Ideally, these articles will stand as a solution for those with specific problems. This is one of those articles.

Don’t forget that you can sponsor 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.

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.

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.

Install Python’s PIP Part One

At first blush, today’s article may seem a bit weird – but I am writing this article to write future articles, so let’s install Python’s PIP. Yes, it may seem strange, but there’s a madness to my method! Yes, yes there is. 

Also, there’s going to be a second part to this article. I’ll link to it when it’s time.

This is something many of you may want to do, even if it doesn’t seem appropriate at this point. There are likely to be several future articles that refer back to this article. You’ll likely guess why after reading this article.

Python is a “high-level” programming language. To some of us, it’s one of the ‘new kids on the block’ but it has been around since 1991. It didn’t gain a lot of popularity until fairly recently, which might be why it seems more modern than it is. Well, to be fair, Python is modern. The language has been upgraded consistently.

So, what is PIP? It stands for PIP Installs Python, or maybe PIP Installs Packages. It depends on who you ask. Much like your regular Linux software, there are applications (written in Python) that can be installed from a central repository. This is, of course, done in the terminal – though I’m sure someone’s authored a GUI PIP installer. (Is ‘installer’ redundant?)

Now, here’s the thing… You can install PIP on pretty much every Linux distro out there. There are a zillion (and three) Python applications that can be trivially installed with PIP. This is a pretty good start at making some new and interesting software immediately available for your use.

So, this article is just going to cover how to install Python’s PIP in a variety of Linux distros. This will, of course, be in the terminal!

IMPORTANT: Read Part 2 to finish installing Python’s PIP.

Install Python’s PIP:

PIP is a terminal-based tool – to me.

Some searching sent me to this package to install Python’s PIP in a GUI. I’ve never tried it, so I can’t speak about the quality. Click the following link to learn more about using PIP in a GUI.

Use a GUI to Manage Python Packages.

Edit: I can’t actually make the above work. It also requires PIP to install it.

For the rest of you, it’s time to crack open your default terminal emulator. The majority of you can open the terminal simply by pressing CTRL + ALT + T. If that’s not an option, the shortcut to open your terminal will be in your application menu. 

Now, the syntax to install Python’s PIP is a bit varied. I can only cover those distros that I know about. If your distro isn’t covered, figure it out and let me know. If I make a mistake for your distro, you should also let me know that too!

I’m going to assume that you’re using a modern distro. There’s an older Python 2 PIP. Your modern distro should require Python 3’s PIP. So, we’ll make that assumption and run with it.

Installation Instructions for Python PIP:

Debian/Ubuntu/etc:

SUSE/OpenSUSE/etc:

Fedora/etc:

Arch/Manjaro/etc:

RHEL/CentOS/etc:

There are other ways to install Python’s PIP, I’m sure. Those directions should cover most of the more popular distros. I did a bunch of searching and that’s what I came up with to fill in what was already in my notes.

I hope the information I found is accurate because I tested only one of those commands and ran that command long ago. If you are a regular reader, you might want to go ahead with the installation at this point. You can be reasonably sure that other articles will reference this one – plus you get to enjoy the warm embrace of Python packages even without my help! (You can find ’em on your own.)

By the way, the installation syntax for Python applications via PIP is simple:

It’s that easy to install Python packages (via the terminal) when you have PIP installed. There are so many packages available and we’ll explore some of my favorites in the future.

Right now, I just wanted to prepare you for the task – and to write an article that I can refer back to, which will save me so much time. Can you imagine if I had to include this information in every article that referred to installing Python packages? Man, don’t underestimate my laziness!

IMPORTANT: Read Part 2 to finish installing Python’s PIP.

Closure:

Today’s article didn’t do a whole lot by itself. You didn’t end up with anything new, other than the ability to install Python’s PIP packages. (That ‘packages’ bit seems rather redundant!) Trust me when I say this will come in handy at some point in your Linux journey. Well, it’ll come in handy if you know about it and use it… It otherwise won’t come in handy. So, make it handy!

If you don’t want to wait for future articles, you can start exploring right now! Head to your nearest search engine and look for packages that can be installed with PIP. I’m almost certain that you’ll find at least some system utility that can be installed. You might even find some games that can be installed via PIP. You never know!

Seriously! Don’t wait for me! If you’re new to Python’s PIP, have fun with it! You can look around and find information on your own. I just facilitate things. Every article on my site could at least be figured out by reading other articles (and some documentation). You don’t need me for anything!

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.

Set Individual Flatpaks Permissions With Flatseal

This will be an article about Flatpaks permissions and how you can set said Flatpaks permissions with Flatseal. There’s a good chance that this will be a relatively short article, which is nice.

BEFORE YOU BEGIN:

I covered what a Flatpak is and some other bits of information. Read this:

Install Flatpaks In Lubuntu

That will give you an overview and enough information to get started. The only thing that will change is how you enable Flatpak and the Flathub repository. The method you use to do that will be different unless you’re using a distro that relies on the apt package manager.

What Is Flatpak:

I wrote this information out already, but some of you will not bother clicking immediately so I’ll mention that a Flatpak is an application that runs with its own dependencies and is sandboxed from the rest of the system.

The important part of this is that the developers who packaged the Flatpak set the permissions for that application. For example, their application may need access to the network. Their application may need access to storage media. The Flatpak may need to be able to access the sound manager so that you can hear things output by the application.

Well, you can adjust those permissions. If you want to grant additional access, you can do that. If you don’t need certain features, you can deny access to those resources. It’s up to you.

The developer shipped the Flatpak with a set of permissions. There are also default permissions that you can edit. If you want to do something like disallow all Flatpak access to the network,  you could do that. You can also adjust these permissions on a per-application basis.

Which leads us to this…

Set Flatpaks permissions with Flatseal:

If you want to manage Flatpaks permissions with Flatseal, you can start (and pretty much close this page) with the following link:

Flatseal on Flathub

The installation instructions will be available on that page. Alternatively, if you’ve already enabled Flatpaks (see the earlier link in this article) you can just press CTRL + ALT + T to open your terminal and enter the following command:

After you enter that into your terminal, you’ll press the Y button on your keyboard a couple of times to confirm that you wish to install.

With that said and done, you can then open your application menu, find Flatseal, and open the application. I’ll give you a screenshot, but there’s just so much more to this application that I can’t cover it. It’s fairly self-explanatory and you should be able to figure it out – but there are many options. 

Flatseal is used to adjust the permissions of a Flatpak.
That’s just the tip of the iceberg. Scroll down and there are maybe 50 options. Good luck!

There are just too many options for me to cover. The best way for you to learn how to use Flatseal is to simply install Flatseal and examine the options. If you have any questions about those options, reach out and I may be able to help. Otherwise, you can figure this out on your own.

I have faith in you. You can figure this one out!

Closure:

Well, you can now adjust Flatpaks permissions with Flatseal. I’m never quite sure how to pluralize or make it possessive, but I did my best. We’ll have to see how the final article does.

Anyhow, I told you this should be a fairly short article. It’s not designated as a short article because it’s a bit long for that and you have to read a bunch of other stuff if you want to use this as your starting point. If I could assume you had Flatpaks already enabled, this could have been a short article. I’ll make no such assumptions.

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.