How to Fix ‘ps: command not found’ error in Linux?

Have you ever encountered the frustrating ‘ps: command not found’ error while working in Linux? I certainly have, and it can be quite a roadblock when trying to monitor processes or troubleshoot system issues. This is a weird error and causes due to the absence of procps module in the system.

The ‘ps’ command is important to check the system resources like the process names, process IDs and many other things. This is a very important module and not having it can cause issues. If your system does not have this module in your system, then you should install it. It is an universal module available in all of the Linux distributions. Regardless of your distribution, I am sharing the exact ways to fix this issue.

ps: command not found in Linux

Fixing ps: command not found error in Linux

This error appears because the ‘ps’ tool is not available to the Terminal. You have to manually install it through various packages like ‘procps’ or ‘procps-ng’ to get access to the tools like ‘ps’, ‘pkill’, ‘top’ and others.

There are two ways to install this tool. The first step is to download and install it using the package manager method. This is the simplest method but differs for each Linux distribution. The second way is to build it from the source, but it’s a difficult method. The benefit is that it is universal for each distribution. Here are both the methods to install this tool and fix the error.

Method #1 – Use Default Package Manager

  • First of all, open the Terminal from Applications Menu or Press “Ctrl + Alt + T” key combination. Type the following commands depending on the Distribution.

For Ubuntu, Debian and Based Distributions

sudo apt update
sudo apt install procps


For RedHat, Fedora, CentOS and Similar Distributions

sudo dnf makecache
sudo dnf install procps


For Arch Linux, Manjaro, Garuda, and Others

sudo pacman -Syu
sudo pacman -S procps-ng

These two commands use the default package manager on each of the distributions. For example, it uses the Pacman Package manager in Arch Linux and first updates the system and then fetches the ‘procps-ng’ and installs it. This is a simplest method and takes only a few seconds to complete. After that, you can use the ‘ps’ command and related parameters without any issues.

Method #2 – Build from Source

For the advanced users like me, the building from source is a fun-filled experience. This method is universal on Linux and works for all of the distributions. If you love such advanced ways to install anything like me, then you should follow these steps.

  • First of all, open the Terminal. You must know how to open it manually and through the keyboard shortcuts.
  • In the Terminal, type or paste the following commands one by one.
git clone https://gitlab.com/procps-ng/procps.git
cd procps
./autogen.sh
./configure
sudo make && sudo make install

These commands first clone the GitHub repository of the procps app, then change the directory to the same, run the script, automatically configure it and then compile and install it on your system. It gives you an idea about the bare-bone structure of the Linux systems.

Conclusion

After everything is done, just run the ‘ps’ command, and it will run without any issues. I’ve never faced this issue before, but many of my friends faced it. I know you must faced this issue, and that’s why you landed on my tutorial. I hope I tried my best to help you fix the command ‘ps’ not found error in Linux. If you are still facing this error after following all the mentioned steps, then you should ask for help in the comments below.

Posted In :

Leave a Reply

Your email address will not be published. Required fields are marked *

Swaraj Nandedkar