The ps command is used to display information about the currently active processes in your system. It provides various information, such as running process names, process IDs, memory usage, and much more.

It's a widely used command-line tool that typically comes pre-installed with nearly all Linux distributions. However, there might be exceptions, like minimal versions of certain Linux distributions that skip this tool, or you might have accidentally removed it while trimming your Linux distribution.

In other scenarios like trying to run this command within a Docker container, you're unlikely to find this command and encounter the error "Command 'ps' not found" error.

ps command not found error

So, if you're currently encountering the above error, don't worry, as today I'll guide you on resolving this issue in almost all Linux distributions.

Fixing the ‘ps: command not found’ error in Linux

To resolve the "ps: command not found" error, simply install the necessary package, like procps or procps-ng, which includes the ps tool along with other utilities such as kill, pkill, top, uptime, w, watch, etc.

The installation can be done by the default package manager of your distribution; I've included installation commands for several popular Linux distributions below.

  • On Debian, Ubuntu, Mint, Pop!_OS, etc.
  • sudo apt update
  • sudo apt install procps
  • On RHEL, CentOS, Fedora, Rocky Linux, AlmaLinux, etc.
  • sudo dnf makecache
  • sudo dnf install procps
  • On Arch, Manjaro, EndeavourOS, Garuda, etc.
  • sudo pacman -Syu
  • sudo pacman -S procps-ng

Alternatively, if you prefer to install the ps tool from source (although it's not advised), you can do that as well. Just ensure you have development tools installed on your Linux system before beginning. You can then use the following series of commands to install it from the source:

  • git clone https://gitlab.com/procps-ng/procps.git
  • cd procps
  • ./autogen.sh
  • ./configure
  • sudo make && sudo make install

Once done, the ps command will become accessible from your command line.

ps command output

That's it. In this article, you've learned to fix the "ps: command not found" error on Linux by installing the necessary package.