dpkg-query -Wf '${Package} - ${Version}\n' | sort -n

Display packages and versions on Debian/Ubuntu distrib

Need admin right to run dpkg-query
Sample Output
aaphoto - 0.41-1ubuntu1
accountsservice - 0.6.15-2ubuntu9.3
acl - 2.2.51-5ubuntu1
acpid - 1:2.0.10-1ubuntu3
acpi-support - 0.140
activity-log-manager-common - 0.9.4-0ubuntu3
activity-log-manager-control-center - 0.9.4-0ubuntu3
adduser - 3.113ubuntu2
adium-theme-ubuntu - 0.3.2-0ubuntu1
aften - 0.0.8+git20100105-0ubuntu2
aircrack-ng - 1:1.1-1.1build1
aisleriot - 1:3.2.3.2-0ubuntu1
alacarte - 0.13.2-2ubuntu4
alien - 8.86
...

2
By: Nicolargo
2012-08-22 10:53:48

These Might Interest You

  • apt-show-versions is a program that shows what packages in the system may be updated and several useful information. The -u option displays a list of upgradeable packages: From: http://www.debian.org/doc/manuals/apt-howto/ch-helpers.en.html Show Sample Output


    -3
    apt-show-versions -u
    cowholio4 · 2009-02-06 17:56:13 0
  • If, for example, you want to remove all kernels and headers but the last three versions, you can't use one of that magic all-in-one "remove old stuff" commands. With this simple but elegant command you can remove a range of versions, or a list of versions with e.g. {14,16,20}. Show Sample Output


    1
    apt purge linux*{14..18}*
    ppq · 2016-04-20 07:44:55 0
  • dpigs is in the package debian-goodies (debian/ubuntu)


    11
    dpigs
    xrm0 · 2009-10-26 20:38:17 0
  • completely remove those packages that leave files in debian / ubuntu marked with rc and not removed completely with traditional tools


    0
    dpkg -l | grep ^rc | awk '{ print $2}' | xargs apt-get -y remove --purge
    Richzendy · 2013-02-15 01:34:37 0
  • I sometimes want to know what packages are installed on my Ubuntu system. I still haven't figured out how to use aptitude effectively, so this is the next best thing. This allows finding by name. The grep '^ii' limits the display to only installed packages. If this is not specified, then it includes listing of non-installed packages as well. Show Sample Output


    1
    dpkg --list '*linux*' | grep '^ii'
    piyo · 2009-02-13 17:05:37 1
  • This will take the packages matching a given `apt-cache search` query (a collection of AND'd words or regexps) and tell you how popular they are. This is particularly nice for those times you have to figure out which solution to use for e.g. a PDF reader or a VNC client. Substitute "ubuntu.com" for "debian.org" if you want this to use Ubuntu's data instead. Everything else will work perfectly. Show Sample Output


    4
    apt-popcon() { (echo \#rank; apt-cache search "$@" |awk '$1 !~ /^lib/ {print " "$1" "}') |grep -Ff- <(wget -qqO- http://popcon.debian.org/by_inst.gz |gunzip); }
    adamhotep · 2012-09-08 00:29:31 0

What Others Think

dpkg --get-selections does the same...
bhanu · 297 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: