2

I would like to know about package information as i have mentioned in my Question .

For example , There is a installed package in my system . So i want to know whether its a main package or dependency to some other package .

Thank you .

Raja G
  • 102,391
  • 106
  • 255
  • 328

4 Answers4

2

Use apt-rdepends

Once installed

sudo apt-get install apt-rdepends

you can use it to show all packages that depend on the package you are wondering about.

For example, if you want to know all of the packages that depend on xorg, and their state, simply do

apt-rdepends -r xorg -p

and it will return the following

tmashos@tmashos-wks:~$ apt-rdepends -r xorg -p
Reading package lists... Done
Building dependency tree       
Reading state information... Done
xorg
  Reverse Depends: kubuntu-active (1.7) [NotInstalled]
  Reverse Depends: kubuntu-desktop (1.254) [NotInstalled]
  Reverse Depends: ltsp-client (5.3.7-0ubuntu2) [NotInstalled]
  Reverse Depends: lubuntu-core (0.38) [NotInstalled]
  Reverse Depends: mythbuntu-desktop (0.77) [NotInstalled]
  Reverse Depends: ubuntu-desktop (1.267) [Installed]
  Reverse Depends: ubuntu-sugar-remix (0.5) [NotInstalled]
  Reverse Depends: ubuntustudio-desktop (0.100) [NotInstalled]
  Reverse Depends: xubuntu-desktop (2.152) [NotInstalled]
kubuntu-active
kubuntu-desktop
  Reverse Depends: edubuntu-desktop-kde (12.02.1) [NotInstalled]
  Reverse Depends: kubuntu-full (1.254) [NotInstalled]
  Reverse Depends: kubuntu-netbook (1.254) [NotInstalled]
edubuntu-desktop-kde
kubuntu-full
kubuntu-netbook
ltsp-client
lubuntu-core
  Reverse Depends: lubuntu-desktop (0.38) [NotInstalled]
lubuntu-desktop
mythbuntu-desktop
ubuntu-desktop
  Reverse Depends: edubuntu-desktop (12.02.1) [NotInstalled]
edubuntu-desktop
ubuntu-sugar-remix
ubuntustudio-desktop
xubuntu-desktop
tmashos@tmashos-wks:~$ 

You can see that xorg is installed because I have ubuntu-desktop installed. It also shows what depends on ubuntu-desktop (edubuntu-desktop). Since I don't have edubuntu-desktop installed, you can see that ubuntu-desktop is the top level.

Zanna
  • 70,465
tgm4883
  • 7,912
  • Oh, that's a brilliant piece of software. – crenshaw-dev Aug 09 '12 at 18:24
  • but how to know that a package is required dependence for other package . – Raja G Aug 11 '12 at 13:04
  • I think that is what tgm4883 has done here. Perhaps we are misunderstanding your question. Can you rephrase your question or maybe provide a more elaborate example of what you want to do? – crenshaw-dev Aug 11 '12 at 13:11
  • That is what this is showing. As you can see, xorg is (as you put it) a required dependency of ubuntu-desktop. That is what Depends is. For things that aren't required dependency Debian (and thus Ubuntu) have 2 more levels known as Recommends and Suggests. Recommends I believe get installed by default, where as Suggests just show as suggested when you run apt-get. – tgm4883 Aug 11 '12 at 18:46
2

Mik has described how one can find the dependencies of a package (those packages which it depends on).

I believe GrSr is trying to find out if any given package has any reverse dependencies - that is, if any packages depend on it.

apt-cache rdepends

An answer to a similar question suggests the use of apt-cache rdepends. For example:

mac9416@lee:~$ apt-cache rdepends ffmpeg
ffmpeg
Reverse Depends:
  libavcodec-extra-52
  youtube-dl
  libavcodec52
  imagemagick
  ffmpeg-dbg
  videotrans
  tovid
  recorditnow
  mytharchive
  libavcodec-extra-52
  kmediafactory
  iriverter
  idjc
  dvdwizard
  dvdrip
  dvd95
  dvd-slideshow
  zoomer
  zoneminder
  xwax
  winff
  videoporama
  ubuntustudio-video
  stopmotion
  soundkonverter
  rtmpdump
  python-scitools
  pacpl
  mythexport
  motion
  luciole
  lives
  libsynfig0
  libavbin0
  kmplayer
  kino
  kdenlive
  jsymphonic
  imagination
  gvb
  get-iplayer
  gallery2
  clive
  bitpim
  libavcodec52
  imagemagick
  ffmpeg-dbg

An even more dramatic example would be apt-cache rdepends python. A lot of packages depend on Python.

Unfortunately, apt-cache rdepends lists all reverse dependencies regardless of whether they are installed.

apt-get remove

Probably the simplest way to acquire the information you are looking for is to try to remove the package in question. If the package is depended on by other installed packages, they will be listed for removal.

For example, if I try sudo apt-get remove apt:

The following packages will be REMOVED:
  apport apport-gtk apt-transport-https apt-xapian-index aptdaemon aptitude apturl command-not-found computer-janitor computer-janitor-gtk gdebi gdebi-core gnome-codec-install jockey-common jockey-gtk
  language-selector language-selector-common libept1 network-manager network-manager-gnome python-apport python-aptdaemon python-aptdaemon-gtk python-debian software-properties-gtk synaptic tasksel
  tasksel-data ubuntu-minimal ubuntu-standard ubuntustudio-desktop update-manager update-manager-core update-notifier update-notifier-common

Obviously a lot of packages depend on APT. On the other hand, if I try sudo apt-get remove youtube-dl:

The following packages will be REMOVED:
  youtube-dl

No installed packages depend on youtube-dl. It is a "main package" rather than a dependency.

A Word of Caution

I highly recommend you add the -s or --simulate argument to any apt-get remove commands used for this purpose unless you really want to remove a package! This will ensure that you don't accidentally give permission to remove something you wanted to keep. For example:

sudo apt-get remove apt -s
sudo apt-get remove youtube-dl -s
crenshaw-dev
  • 31,762
1

One way is to use apt-cache, which you can use to query many packages or search for them. It is important to note that with apt-cache it will return data on the package queried whether it is installed or not.

With, for example, apt-cache show skype you can view all information about the package; to view summary information on the package use apt-cache showpkg skype, which will show dependencies and also reverse dependencies, which are packages that depend on Skype. However, to view just those packages that Skype depends on, for example, use apt-cache depends skype:

apt-cache depends skype
    skype
      Depends: libasound2
      Depends: libc6
      Depends: libgcc1
      Depends: libqt4-dbus
      Depends: libqt4-network
      Depends: libqtcore4
      Depends: libqtgui4
      Depends: libstdc++6
      Depends: libx11-6
      Depends: libxext6
      Depends: libxss1
      Depends: libxv1

There are many other useful features of apt-cache documented in man apt-cache such as the ability to show available versions and the current priority of versions; to see this information enter apt-cache policy skype.

For how to use dpkg to find out which files are from which packages, see this article.

0

If you prefer, you could also go into synapic package manager.
If it is not installed run

sudo apt-get install synaptic

Just search for your package, right click on it, and choose properties.
From there you can find it's dependencies and dependents, among other things...

Zanna
  • 70,465