I found myself in a situation where I need to reinstall the ps binary. I accidentally copied the binary to another location and immediately deleted it. The binary is no longer in the bin directory.
I have attempted to reinstall the coreutils package in Ubuntu, but ps was not reinstalled; is there another package where ps comes from?
2 Answers
Using dpkg -S /bin/ps will tell you that this program is in the procps package. Reinstall it using apt-get install --reinstall procps.
Using the Packages website
The site comes in handy in such situations.
Example: search package contents for ps reveals the procps package.
Using the command-not-found feature
Type the command misspelled and search the suggested packages:
$ ps-
No command 'ps-' found, did you mean:
Command 'psi' from package 'psi' (universe)
Command 'psc' from package 'sc' (universe)
Command 'psf' from package 'tcm' (universe)
Command 'ps' from package 'procps' (main)