LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 08-02-2011, 02:32 AM   #1
austinium
Member
 
Registered: Nov 2007
Location: India
Distribution: Debian Stable, Debian Testing
Posts: 219

Rep: Reputation: 27
difference between dpkg -l and dpkg -get-selections


Hi,

i usually use
Code:
$dpkg -l
to get the list of packages installed on Debian.

http://www.linuxquestions.org/questi...ckages-894808/
as per the the above thread
Code:
$dpkg --get-selections
does the same.

however on my machine, the number of packages is different for both these commands.

Code:
user@user:~$ dpkg --get-selections|wc -l
1683
user@user:~$ dpkg -l|wc -l
1688
The man page for dpkg states that the -l option:
Code:
-l, --list package-name-pattern...
List packages matching given pattern.
so i guess giving it no pattern to match makes it list out all packages.

the man entry for --get-selections is similar
Code:
--get-selections [package-name-pattern...]
Get  list  of  package selections, and write it to stdout. Without a pattern, non-installed packages (i.e. those which have been previously purged) will not be shown.
so why the difference?

doesk dpkg -l list packages which were previously purged?
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 08-02-2011, 03:15 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
dpkg -l is a package list to read for humans, there it has an header with explanations that counts 5 lines, here in German:
Code:
Gewünscht=Unbekannt/Installieren/R=Entfernen/P=Vollständig Löschen/Halten
| Status=Nicht/Installiert/Config/U=Entpackt/halb konFiguriert/
         Halb installiert/Trigger erWartet/Trigger anhängig
|/ Fehler?=(kein)/R=Neuinstallation notwendig (Status, Fehler: GROSS=schlecht)
||/ Name                                           Version                                        Beschreibung
+++-==============================================-==============================================-============================================================================================================
dpkg --get-selections is not intended to be human readable (although it is), but to get a bunch of selections that can be used to install the same packages again on a different install with dpkg --set-selections && apt-get dselect-upgrade.
 
2 members found this post helpful.
Old 08-02-2011, 06:12 AM   #3
austinium
Member
 
Registered: Nov 2007
Location: India
Distribution: Debian Stable, Debian Testing
Posts: 219

Original Poster
Rep: Reputation: 27
thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the prob krishna.nitk Linux - Newbie 3 03-21-2009 02:41 PM
Ubuntu newbie, E: dpkg was interrupted, you must manually run 'dpkg --configure -a' ? chinkychan Linux - Newbie 1 01-28-2009 10:21 PM
Dpkg/dselect database mess up: Reset selections!! ignasiet Debian 4 05-22-2007 04:28 AM
dpkg --get-selections still shows deinstall pljvaldez Debian 0 02-17-2006 01:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 06:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration