How to install real 'ps' command on Alpine Linux

So I have Alpine Linux VM because we have Docker with Alpine as base image. I need to debug some stuff. I ended up reading Linux how long a process has been running? - nixCraft and noticed the ps -p {PID-HERE} -o etime doesn’t work on Alpine Linux. Is it possible to get real /bin/ps instead of garbage version of the ps command shipped with Alpine Linux?

It is not a garbage version. However, it is limited in options compared to the standard ps provided by the procps-ng Procps-ng download | SourceForge.net because it uses a busybox.

Installing ps command from procps-ng on Alpine Linux

  1. Open the terminal app.
  2. Login as the root user.
  3. Type the apk update && apk upgrade command
  4. Install ps by typing the apk add procps command
  5. Now you can use it /bin/ps.

See the apk command example in Alpine Linux for more info.

1 Like