Date created: Tuesday, January 21, 2020 8:50:16 AM. Last modified: Sunday, November 3, 2024 3:21:04 PM

'apt' & 'dpkg' & 'snap' - Notes

List installed packages:

apt list --installed

or

aptitude search '~i!~M'

or

dpkg --get-selections | grep -v deinstall

or

snap list

 

Remove packages:

snap remove xxx

 

Only upgrade a single package:

sudo apt-get install --only-upgrade sublime-text

 

Disable auto-updates in Ubuntu:

# For Ubuntu 18 and 20:
$cat /etc/apt/apt.conf.d/20auto-upgrades APT::Periodic::Update-Package-Lists "0"; APT::Periodic::Download-Upgradeable-Packages "0"; APT::Periodic::AutocleanInterval "0"; APT::Periodic::Unattended-Upgrade "0";

# As of Ubuntu 22 this doesn't work anymore.
# One can remove the updata-manager programe which creates the constant anying prompts to update:
$ sudo apt remove update-manager

# Restore it with:
$ sudo apt install update-manager

 

Export and install a list of packages:

dpkg --get-selections | grep -v deinstall > ~/Desktop/packages

sudo dpkg --set-selections < ~/Desktop/packages && sudo apt-get -u dselect-upgrade

 

Force apt to use IPv4 or IPv6:

apt-get -o Acquire::ForceIPv4=true update
apt-get -o Acquire::ForceIPv6=true update

 

Run apt with debug logging enabled:

apt-get -oDebug::pkgAcquire::Worker=1 update

 

Update a specific package:

sudo apt-get install --only-upgrade XXXX