For some reason we terminate the installation of package via
apt-get by pressing ctrl+z,it creates a lock file inside
And after that if we want to install another or same package via
apt-get,we have to manually remove the lock by running these two commands
sudo rm /var/lib/dpkg/lock and
sudo rm /var/cache/apt/archives/lock so that the installation will occurs.
My question: Is there any way to remove the lock files automatically that was created after pressing ctrl+z,so that we don't need to remove the lock files manually.