Tuesday, June 4, 2019

package management - Command-line equivalences of some tasks in Synaptic


I already use apt-get for most of my package management. Yet, there are times when I occasionally need to use Synaptic to do certain things. I would like to learn the equivalent commands for doing the following things in Synaptic:



  • Check a package's dependencies / dependent packages. (This can be done in Synaptic by viewing the properties of a package).

  • Browse available packages

  • Search (in package names as well as the details/descriptions) for some key. (The search function at the top of synaptic)

  • Check if a package is installed or not


Also, is there a way to find packages that are no longer necessary (e.g. a package no longer in use because I removed a dependency). I have a feeling my system is terribly bloated because I removed certain programs and not all the dependencies went with them.




  • Check a package's dependencies / dependent packages. (This can be done in Synaptic by viewing the properties of a package):


    apt-cache depend 'package-name'
    apt-cache rdepend 'package-name'

  • Browse available packages


    apt-cache pkgnames
    apt-cache search '.*'
    apt-cache show 'package-name'

  • Search (in package names as well as the details/descriptions) for some key. (The search function at the top of synaptic)


    apt-cache search pattern
    apt-cache --names-only search pattern

  • Check if a package is installed or not


    dpkg -l | grep package-name


The last one could not give the desired result, because when the terminal width is narrow the columns are truncated. Safer alternatives are


dpkg-query -Wf '${Package}\n' | grep pkg
dpkg --get-selections | grep pkg

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...