0

It seems that I've removed head manually from my /usr/bin/ a couple of months ago. Now that I chance to need it I don't have it. How do I reinstall it without reinstalling the whole distro? My environment: Ubuntu 20.04 LTS Desktop.

Wieland
  • 6,489
  • 1
    Also: https://unix.stackexchange.com/questions/115743/i-deleted-bin-rm-how-do-i-recover-it/115744 https://unix.stackexchange.com/questions/238475/reinstall-env-program – muru Sep 28 '21 at 01:26
  • @muru Thanks for the links, the solutions in them were relevant to my problem as well. – John Smith Sep 28 '21 at 03:27

1 Answers1

10

You can re-install head by re-installing the package which contains it; from a terminal window, run

sudo apt reinstall coreutils

(In older versions of apt, pre-1.8.0~rc1, run sudo apt install --reinstall coreutils instead.)

You can determine which package is involved by running

dpkg -S bin/head
Stephen Kitt
  • 434,908
  • I was going to suggest https://packages.ubuntu.com/ as another option. However, for some reason, the "packages that contain files named like this" search doesn't find anything with the keyword "/usr/bin/head", but gives exactly that file if I search for "/bin/head" instead... (??) – ilkkachu Sep 27 '21 at 14:37
  • @ilkkachu right, files are moving around with the /usr merge, it’s safer to look for bin/head. – Stephen Kitt Sep 27 '21 at 14:38