Installing and removing packages

To find an installed package:

sudo apt list --installed | grep packagename

To remove the specified package:

sudo apt-get remove --purge packagename

Do the following to correct any installation error:

1
2
3
4
sudo apt-get update
sudo apt-get autoclean
sudo apt-get clean
sudo apt-get autoremove

Many thanks to Bobov Ivan for the example command to install packages for debugging:

apt-get install -y --no-install-recommends \
    nano=2.7.4-1 \
    iputils-ping=3:20161105-1 \
    net-tools=1.60+git20161116.90da8a0-1 \
    less=481-2.1 \
    telnet=0.17-41 \
&& apt-get clean autoclean \
&& apt-get autoremove --yes \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/