An already installed package on a Debian based system may be repackaged into a Debian *.deb file for sharing with someone else, or for a backup if the user wishes. This is very useful. Also, it is possible to get information about the number of installed packages, and the number of Debian packages available for installation. This is pertinent information if the user wishes to know about the size of the Linux Mint or Debian package repositories. This could be useful for comparison`s sake. Comparing the size of a Debian repo to that of the Ubuntu repositories for example. That could be an interesting exercise.
Install the dpkg-repack
package first of all.
jason@Yog-Sothoth » opera » $ sudo apt install dpkg-repack
Then repack a package from your system. This will be created in the current directory.
jason@Yog-Sothoth » opera » $ sudo dpkg-repack mplayer dpkg-repack: warning: unknown information field 'Original-Maintainer' in input data in entry in dpkg's status file dpkg-deb: building package 'mplayer' in './mplayer_1.3.0-7build2_amd64.deb'.
And it works a treat.
jason@Yog-Sothoth » opera » $ ls mplayer_1.3.0-7build2_amd64.deb
This is a great way to repackage an installed program for whatever reason.
To count installed packages, use this.
jason@Yog-Sothoth » opera » $ dpkg --get-selections | wc --lines 3559
This displays the number of installed packages.
This command will list all pending upgrades.
jason@Yog-Sothoth » opera » $ apt list --upgradable Listing... Done ubiquity/bionic-proposed 18.04.14.3 amd64 [upgradable from: 18.04.14.2] ubiquity-frontend-gtk/bionic-proposed 18.04.14.3 amd64 [upgradable from: 18.04.14.2] ubiquity-ubuntu-artwork/bionic-proposed,bionic-proposed 18.04.14.3 all [upgradable from: 18.04.14.2] update-notifier/bionic-proposed 3.192.1.2 amd64 [upgradable from: 3.192.1.1] update-notifier-common/bionic-proposed,bionic-proposed 3.192.1.2 all [upgradable from: 3.192.1.1]
To count the number of packages in the package repositories for Ubuntu or Mint, use this command.
jason@Yog-Sothoth » opera » $ apt-cache pkgnames | wc -l 61368
This tells me that there are 61,368 packages in the repositories for my Ubuntu 18.04 system. This goes to show how easy it is to get information about installed packages and package availability with the Linux command line, and it could be very useful to someone out there.
List all package repositories in the /etc/apt/sources.lst file with this simple one-liner.
jason@Yog-Sothoth » opera » $ grep -r --include '*.list' '^deb ' /etc/apt/sources.list /etc/apt/sources.list.d/ /etc/apt/sources.list:deb http://au.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse /etc/apt/sources.list:deb http://au.archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse /etc/apt/sources.list:deb http://au.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse /etc/apt/sources.list:deb http://au.archive.ubuntu.com/ubuntu/ bionic-proposed main restricted universe multiverse
Getting information about the status of your Linux Mint or Ubuntu package manager is therefore very easy. Give these tips a go on your own system.