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.

Let’s Count The Running Processes In Linux

This article will show you how to count the running processes on your Linux system. Like many articles, it will show you how to use some tools that you may not yet know about.

The tools in question will be ‘ps‘ and ‘wc‘. The ‘ps’ command reports the current processes and the ‘wc’ stands for word count and has uses beyond just counting individual words, as this article will show you.

If you’re curious, the man page describes them as:

ps – report a snapshot of the current processes.

And:

wc – print newline, word, and byte counts for each file

We will be using both of these tools, not just to just count the running processes, but also to expose you to these tools. After all, it’s really not all that important to count the running processes. I suppose if you have resource constraints, but it’s not so important the number of running processes – but how computationally expensive those processes are.

So, this should actually be a pretty short article and it’s definitely in the beginner territory. If you’re an advanced user, it’s likely that you’ll have at least some familiarity with these tools. Even if you’re an expert, have some fun and read on!

Count The Running Processes:

Like many other articles on this site, we start with an open terminal. You can open your terminal with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With the terminal now open, we’ll start with the ‘ps’ command. Running just ‘ps’ is pretty useless, so be sure to check man ps for more information. Instead, we’ll run it with the -e flag to show every running process.

Tada! That shows you every running process. Now, let’s see the same command with the -U flag. You can’t just use the -U flag by itself, it requires a username. So, try this to show all the processes being run by a specific user:

Where you see <user>, put your username. In my case, the command would look like ps -U kgiii – and don’t forget that it is case sensitive and lowercase letters are all you can use in your username. Anyhow, that command will show the running processes owned by the user ‘kgiii’.

So, all that is well and good. How about we now count them? To do that, you just need to add a pipe and wc -l. We’ve used a pipe before, and the pipe is one of the greatest concepts in Linux – as it allows you to take the output from one command and pipe it into a new command.

Using the information above, we would then try:

And to count the processes from a specific user, you’d just use:

An example output of the latter would look something like this:

A count of processes owned by user 'kgiii'.
Counting the processes owned by user ‘kgiii’. A nice even 200, strangely enough.

That’s about it, really. You can check the man pages for both ‘ps’ and ‘wc’ to learn more about them, but this would be how I’d count the running processes on my Linux boxes. 

Closure:

There you have it, another article – this one telling how to count the running processes. Hopefully, we all learned a little something today and hopefully we’ll all learn a little something new in two days – which is when the next article should come out.

We’re approaching the halfway point in this year-long project. It has been good fun and I’ve learned a great deal. If I had to speculate, I would guess that this project will keep going beyond the one year mark, though maybe with a more lenient publishing schedule!

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.