Hello, friends. Now in this post, I will show you how to install and use the procs command to show processes in Linux from the terminal. So, let’s get to it.
What is the procs command?
procs is a replacement for ps written in Rust. Now, what can we do with the procs
command is to display the status of the processes that are running on the system.
It is a tool created in Rust language and is open source so the source code is accessible to everyone. It is designed for Linux, but there is experimental support for macOS and Windows so in the future we can expect that they will be fully supported.
Some of the features of procs
- Pager support
- Watch mode (like top)
- Tree view
- Multi-column keyword search
- Colored and human-readable output
But there is more because unlike ps
we will be able to have more memory information and support for Docker containerization.
So as we can see, this very simple-to-use command allows us to have a solid alternative and with more features than with ps
. This can be useful to many professionals.
So, before using it we have to install it.
Install procs command in Linux
One of the most appealing things about certain tools is the ability to have multiple ways to install them. This is the case with procs and we can choose multiple ways to install it.
First, we will be able to install it using HomeBrew for it is enough to run
brew install procs
If you do not know how to install Homebrew, in this post we tell you how.
In case of using Ubuntu or some derivative, it is possible then, to use snap
and to install it just run
sudo snap install procs
In the case of Fedora, you just have to run
sudo dnf install procs
And for Arch Linux and derivatives
sudo pacman -S procs
For the rest of the distributions, we have two options. If you have load
on the system, you can install procs as follows
cargo install procs
Or by downloading the binary from the Github site and adding it to your PATH.
So, download it and unzip it
wget https://github.com/dalance/procs/releases/download/v0.11.10/procs-v0.11.10-x86_64-lnx.zip
unzip procs-v0.11.10-x86_64-lnx.zip
Now move the binary to a path in your PATH with the corresponding permissions.
sudo mv procs /usr/local/bin/ sudo chmod +x /usr/local/bin/procs
You can then check that it works by running
procs -V
So, we can use it now.
Using the procs command in Linux
With the procs
command installed we have to use it from the terminal. But first, let’s do a little trick.
By default, some characters are not displayed because of configuration problems. This can be solved by adding the following to the ~/.bashrc
file
export LESSCHARSET=utf-8
And then applying the changes as follows.
source ~/.bashrc
Now, just run the command
procs
In this simple way, you can get the processes that are active on the system.
As you can see in the image, the default columns that are shown by default are
- The PID of the process
- The user running the process.
- TTY
- Percentage of CPU that is used by the process.
- Amount of memory used
- CPU time
- The command that executes the process without arguments.
As we can see it is basic information but it is useful for any sysadmin.
If many processes are active, you can see the rest by scrolling with the arrow keys. To exit press the q
key
You can search for a specific process or by adding a keyword. For example
procs al
And it will search for all processes that match this character.
If instead of a word you specify a number, then information about the process whose PID matches the entered number will be displayed.
procs 12
Other useful procs options
An option that does continuous monitoring of processes similar to topis the –watch
option.
procs --watch
Although we can also define a monitoring interval.
procs --watch-interval 10
This unit is expressed in seconds.
When you are on this screen, you can sort the active column by pressing the d and a keys for descending and ascending respectively. And you can end the command execution by pressing q.
There are a lot of other settings you can check in this link.
Conclusion
Some commands can be useful for our administration of a server or a Linux computer.
So, enjoy it.