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 .
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
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.
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.
apt-cache rdepends lists all reverse dependencies regardless of whether they are installed.
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.
I highly recommend you add the
--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
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
edubuntu-desktop). Since I don't have
edubuntu-desktop installed, you can see that
ubuntu-desktop is the top level.
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.