Show one line summaries of all DEB packages installed on Ubuntu based on pattern search

dpkg --list '*linux*' | grep '^ii'
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.
Sample Output
ii  linux-headers-2.6.24-23                    2.6.24-23.48                      Header files related to Linux kernel version 2.6
ii  linux-headers-2.6.24-23-virtual            2.6.24-23.48                      Linux kernel headers for version 2.6.24 on x86
ii  linux-headers-virtual                                  Linux kernel headers for the virtual flavour
ii  linux-image-2.6.24-23-virtual              2.6.24-23.48                      Linux kernel image for version 2.6.24 on x86
ii  linux-image-virtual                                    Description: Linux kernel image geared towards v
ii  linux-libc-dev                             2.6.24-23.48                      Linux Kernel Headers for development
ii  linux-restricted-modules-common                     Non-free Linux 2.6.24 modules helper script
ii  linux-sound-base                           1.0.16-0ubuntu4                   base package for ALSA and OSS sound systems
ii  linux-ubuntu-modules-2.6.24-23-virtual     2.6.24-23.37                      Ubuntu supplied Linux modules for version 2.6.24
ii  linux-virtual                                          Complete Linux kernel geared towards virtualised
ii  util-linux                                 2.13.1-5ubuntu3                   Miscellaneous system utilities
ii  util-linux-locales                         2.13.1-5ubuntu3                   Locales files for util-linux

By: piyo
2009-02-13 17:05:37

What Others Think

Piping dpkg output through some command is also a great way to get the full package name. I used to get frustrated when doing a dpkg -l 'linux*' ...since the package name would get chopped off after 14 characters. Simply piping things through 'cat' will print the whole package name: dpkg -l 'linux*' | cat
mulad · 674 weeks and 2 days ago
seofox · 9 weeks and 1 day 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? 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.


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: