linuxubuntucommandaptreinstall

How can I reinstall apt?


Hi! I deleted by mistake, the command apt and apt-get...

My OS: Ubuntu 16.04 TLS

Error:

-bash: /usr/bin/apt: No such file or directory
-bash: /usr/bin/apt-get: No such file or directory

How can I reinstall APT command?


Solution

  • check out the packages.ubuntu.com page and look for the apt package, there you can download the binary .deb file depending on your processor architecture...

    enter image description here

    But consider that, the deb files have some dependencies... you have to install them too, for listing the package dependencies, use the dpkg, eg:

    dpkg -I apt-armhf-blahblah.deb
    

    if you deleted the apt package by itself, take a look at its log file in /var/log/apt/history.log, you can discover the name of packages that you removed.

    HINT 1: since the DPKG can't automatically install the dependencies, you have to install them one by one!

    HINT 2: that's recommended to remove your current OS and install the latest version because this version will not receive any maintenance update anymore.