Get information about the location of an installed program. This shows the location of the executable file.
┌──(john㉿DESKTOP-PF01IEE)-[~] └─$ dpkg -S $(readlink -f $(which xterm)) xterm: /usr/bin/xterm |
Find all of the executables that go with a certain package.
┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Videos] └─$ dpkg -S xterm | grep bin xterm: /usr/bin/lxterm xterm: /usr/bin/xterm xterm: /usr/bin/koi8rxterm xterm: /usr/bin/uxterm |
Download a Debian package but do not install it.
┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Documents/Ubuntu] └─$ sudo apt-get install --download-only leafpad |
This file may be found under the /var/cache/apt/archives folder 📂.
Extract the tar file from inside a Debian deb package.
┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Documents/Ubuntu] └─$ dpkg --fsys-tarfile /var/cache/apt/archives/ansiweather_1.11-1.1_all.deb > ansiweather.tar |
That could be useful if you wish to get a file from a Debian package but do not need to install it. Just download the package and then extract the file(s) you need from it.
If you wish, you can use further compression on the file to make it smaller.
┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Documents/Ubuntu] └─$ bzip2 ansiweather.tar |
List the contents of a Debian package with dpkg.
┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Documents/Ubuntu] └─$ dpkg -c /var/cache/apt/archives/ansiweather_1.11-1.1_all.deb drwxr-xr-x root/root 0 2021-01-03 22:58 ./ drwxr-xr-x root/root 0 2021-01-03 22:58 ./usr/ drwxr-xr-x root/root 0 2021-01-03 22:58 ./usr/bin/ -rwxr-xr-x root/root 10427 2017-06-22 06:30 ./usr/bin/ansiweather drwxr-xr-x root/root 0 2021-01-03 22:58 ./usr/share/ drwxr-xr-x root/root 0 2021-01-03 22:58 ./usr/share/doc/ drwxr-xr-x root/root 0 2021-01-03 22:58 ./usr/share/doc/ansiweather/ -rw-r--r-- root/root 102 2017-06-22 06:30 ./usr/share/doc/ansiweather/AUTHORS -rw-r--r-- root/root 2217 2017-06-22 06:30 ./usr/share/doc/ansiweather/README.md.gz -rw-r--r-- root/root 34 2017-06-22 06:30 ./usr/share/doc/ansiweather/ansiweather.plugin.zsh -rw-r--r-- root/root 886 2017-06-22 06:30 ./usr/share/doc/ansiweather/ansiweatherrc.example -rw-r--r-- root/root 995 2021-01-03 22:58 ./usr/share/doc/ansiweather/changelog.Debian.gz -rw-r--r-- root/root 1500 2017-06-22 06:30 ./usr/share/doc/ansiweather/changelog.gz -rw-r--r-- root/root 2331 2017-08-27 05:11 ./usr/share/doc/ansiweather/copyright drwxr-xr-x root/root 0 2021-01-03 22:58 ./usr/share/man/ drwxr-xr-x root/root 0 2021-01-03 22:58 ./usr/share/man/man1/ -rw-r--r-- root/root 1325 2021-01-03 22:58 ./usr/share/man/man1/ansiweather.1.gz |
Count the number of installed packages on your Debian system.
┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Documents/Ubuntu] └─$ dpkg --get-selections | wc -l 1353 |
Count the total number of packages in the repositories for your Distribution.
┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Documents/Ubuntu] └─$ sudo apt-cache pkgnames | awk 'END{print NR}' 63302 |
Or like this.
┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Documents/Ubuntu] └─$ sudo apt-cache pkgnames | awk 'END { print "Total available packages: " NR }' Total available packages: 63302 |
This works very well indeed.