Getting a list of installed packages

2005-12-27 Thread J Merritt
Is there a way to get a list of installed packages in Debian, preferably from the command line and preferably in a text file?Thanks in advance for any suggestions.JM
		Yahoo! Photos 
Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.

Re: Getting a list of installed packages

2005-12-27 Thread Jaime Casanova
On 12/27/05, J Merritt [EMAIL PROTECTED] wrote:
 Is there a way to get a list of installed packages in Debian, preferably
 from the command line and preferably in a text file?

 Thanks in advance for any suggestions.

 JM


dpkg-query

i think it needs some options and redirect the output to a file


--
regards,
Jaime Casanova
(DBA: DataBase Aniquilator ;)



Re: Getting a list of installed packages

2005-12-27 Thread Mike Bird
On Tue, 2005-12-27 at 12:53, J Merritt wrote:
 Is there a way to get a list of installed packages in Debian,
 preferably from the command line and preferably in a text file?

dpkg-query --show --showformat='${STATUS} ${PACKAGE} ${VERSION}
${ARCHITECTURE}\n'

(All on one line.)  You can write the output of this to a text file. 
You can drop some of the fields if you don't need them.

--Mike Bird


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Getting a list of installed packages

2005-12-27 Thread Kjetil Kjernsmo
On Tuesday 27 December 2005 21:53, J Merritt wrote:
 Is there a way to get a list of installed packages in Debian,
 preferably from the command line and preferably in a text file?

Yup, you could do 
dpkg --get-selections | grep install  file.txt
or 
dpkg -l | grep ^ii  file.txt
depending on your needs. See also the dpkg manpage.

Cheers,

Kjetil
--
Kjetil Kjernsmo
Programmer / Astrophysicist / Ski-orienteer / Orienteer / Mountaineer
[EMAIL PROTECTED]
Homepage: http://www.kjetil.kjernsmo.net/ OpenPGP KeyID: 6A6A0BBC


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Getting a list of installed packages

2005-12-27 Thread Steve Kemp
On Tue, Dec 27, 2005 at 12:53:46PM -0800, J Merritt wrote:
Is there a way to get a list of installed packages in Debian, preferably
from the command line and preferably in a text file?
 
Thanks in advance for any suggestions.

  To show all installed packages you can use the dpkg command, and
 then filter the list via grep to those that are installed.  (And not
 removed/purged).  To do this run:

[EMAIL PROTECTED]:~$ dpkg --list |grep ^ii

  You might find the package name is truncated, so can fix this
 by running:

[EMAIL PROTECTED]:~$ COLUMNS=200 dpkg --list |grep ^ii

  Finally if you just want to see the *name* of the package you can
 use awk to print that out alone.  This stops you from seeing the
 one-line package description too:

[EMAIL PROTECTED]:~$ COLUMNS=200 dpkg --list |grep ^ii | awk '{print $2}'

  If you wish this list to be in a file just use redirection:

[EMAIL PROTECTED]:~$ COLUMNS=200 dpkg --list |grep ^ii | awk '{print $2}'  
list.txt

Steve
-- 
Debian GNU/Linux System Administration
http://www.debian-administration.org/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Getting a list of installed packages

2005-12-27 Thread Joris Huizer

Jaime Casanova wrote:

On 12/27/05, J Merritt [EMAIL PROTECTED] wrote:


Is there a way to get a list of installed packages in Debian, preferably
from the command line and preferably in a text file?

Thanks in advance for any suggestions.

JM




dpkg-query

i think it needs some options and redirect the output to a file


--
regards,
Jaime Casanova
(DBA: DataBase Aniquilator ;)




this might do it too
dpkg -l *|grep ^i


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: Getting a list of installed packages

2005-12-27 Thread Philippe Grenard
Le Mardi 27 Décembre 2005 21:53, J Merritt a écrit :
 Is there a way to get a list of installed packages in Debian, preferably
 from the command line and preferably in a text file?

   Thanks in advance for any suggestions.

   JM


 -
 Yahoo! Photos
  Ring in the New Year with Photo Calendars. Add photos, events, holidays,
 whatever.
Hi,

dpkg --get-selections  pkg_list.txt



Re: Getting a list of installed packages

2005-12-27 Thread ke6isf
On Tue, 27 Dec 2005, J Merritt wrote:

 Is there a way to get a list of installed packages in Debian, preferably from 
 the command line and preferably in a text file?

COLUMNS=200 dpkg -l |awk '/^[hi]i/{print $2}'

This will generate a list of only the names of packages that are
installed.  I use this to back things up so that, in the event I need to
do a bare metal reinstall, I can just restore my sources.list, apt-get
update, and 'apt-get install package-listing'.

-Dennis Carr


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Getting a list of installed packages

2000-11-16 Thread Robert Guthrie
On Wednesday 15 November 2000 21:16, John Carline wrote:

 Ahh! I see. You're probably right, but that's caused by the dpkg command
 isn't it - not the pipe?  Didn't 'dpkg - l'  by itself produce what was
 wanted?

 If the full version is what's needed, it's listed in /var/lib/dpkg/status.
 The dpkg command cuts it off at 14 characters so the real question may be
 is there a way to make dpkg  produce the entire version field?

 I don't think so, but I could easily be wrong.

 John

 --

 Powered by the Penguin
In another branch of this thread, Colin Watson pointed out that dpkg seems to 
know if its output is going to screen (like a wide xterm) or to a pipe, and 
if it is going through a pipe, it defaults to an arbitrary width (which makes 
sense, the pipe is as wide as it needs to be).  

He also pointed out grep-dpkg and friends, which are what I intend to use.

-- 
Did you know that if you play a Windows 2000 cd backwards, you 
will hear the voice of Satan?

That's nothing!  If you play it forward, it'll install Windows 2000.



Re: Getting a list of installed packages

2000-11-16 Thread Colin Watson
Robert Guthrie [EMAIL PROTECTED] wrote:
On Wednesday 15 November 2000 21:16, John Carline wrote:
 Ahh! I see. You're probably right, but that's caused by the dpkg
 command isn't it - not the pipe?  Didn't 'dpkg - l'  by itself
 produce what was wanted?

 If the full version is what's needed, it's listed in
 /var/lib/dpkg/status. The dpkg command cuts it off at 14 characters
 so the real question may be is there a way to make dpkg  produce the
 entire version field?

 I don't think so, but I could easily be wrong.

In another branch of this thread, Colin Watson pointed out that dpkg
seems to know if its output is going to screen (like a wide xterm) or
to a pipe, and if it is going through a pipe, it defaults to an
arbitrary width (which makes sense, the pipe is as wide as it needs
to be).  

Well, actually, from main/enquiry.c in the dpkg source:

  else if (!isatty(1))
ws.ws_col=80;

So actually it defaults to 80 characters (useful if you happened to be
piping it through a pager, for example). 'dpkg -l' is really just for
pretty(ish) formatted output for humans.

He also pointed out grep-dpkg and friends, which are what I intend to use.
   dctrl

Great!

Regards,

-- 
Colin Watson [EMAIL PROTECTED]



Getting a list of installed packages

2000-11-15 Thread Robert Guthrie
I'm using this command:
dpkg -l * | egrep ^ii | grep -i kde

and getting this output:
snip
ii  ksirc  2.0-final-0.po IRC Client based on QT and KDE
ii  ksirtet2.0-final-0.po Tetris and Puyo-Puyo games for KDE 
snip

What I'm trying to get is the full version information.  I only care about 
that and the package name.

Thanks!
-- 
Did you know that if you play a Windows 2000 cd backwards, you 
will hear the voice of Satan?

That's nothing!  If you play it forward, it'll install Windows 2000.



Re: Getting a list of installed packages

2000-11-15 Thread Moritz Schulte
Robert Guthrie [EMAIL PROTECTED] writes:

 I'm using this command:
 dpkg -l * | egrep ^ii | grep -i kde

It seems that 'dpkg -l' (without the pattern) lists all installed
packages, so you don't need to filter the installed packages out. But,
this isn't important...

 and getting this output:
 snip
 ii  ksirc  2.0-final-0.po IRC Client based on QT and KDE
 ii  ksirtet2.0-final-0.po Tetris and Puyo-Puyo games for KDE 
 snip
 
 What I'm trying to get is the full version information.  I only care about 
 that and the package name.

You can do it with awk: dpkg -l | awk '{ print $2   $3 }'

moritz
-- 
/* Moritz Schulte [EMAIL PROTECTED]
 * http://hp9001.fh-bielefeld.de/~moritz/
 * PGP-Key available, encrypted Mail is welcome.
 */



Re: Getting a list of installed packages

2000-11-15 Thread Robert Guthrie
On Wednesday 15 November 2000 11:43, Moritz Schulte wrote:
 Robert Guthrie [EMAIL PROTECTED] writes:
  I'm using this command:
  dpkg -l * | egrep ^ii | grep -i kde
snip
  What I'm trying to get is the full version information.  I only care
  about that and the package name.

 You can do it with awk: dpkg -l | awk '{ print $2   $3 }'

   moritz

That didn't work either.  It seems that anything I run through a pipe gets 
truncated.  I'm not sure why.  If I just run dpkg -l all by itself, I get a 
nicely spaced output that I could cut and past from, but that would require 
me to do the work that my computer should do for me ;-).  Any suggestions?  
Running this at the console (as opposed to an X terminal window) doesn't 
behave any differently.

-- 
Did you know that if you play a Windows 2000 cd backwards, you 
will hear the voice of Satan?

That's nothing!  If you play it forward, it'll install Windows 2000.



Re: Getting a list of installed packages

2000-11-15 Thread Colin Watson
Robert Guthrie [EMAIL PROTECTED] wrote:
I'm using this command:
dpkg -l * | egrep ^ii | grep -i kde

and getting this output:
snip
ii  ksirc  2.0-final-0.po IRC Client based on QT and KDE
ii  ksirtet2.0-final-0.po Tetris and Puyo-Puyo games for KDE 
snip

What I'm trying to get is the full version information.  I only care about 
that and the package name.

'dpkg -l' is designed to produce output that looks reasonable on the
screen, so sometimes it has to truncate version numbers. In an X
terminal, resizing the terminal will cause it to produce wider output;
otherwise (e.g. to a pipe), dpkg-1.7.0 and above (only in woody) will
look at the COLUMNS environment variable to determine the width of the
display for which the output should be formatted.

If you're automatically processing the output, however, 'dpkg -l' isn't
really the right tool to use. For individual packages you can do
something like 'dpkg -s foo | grep ^Version:'. For the sort of search
you're doing you should really install the grep-dctrl package, and then
you can do this:

  grep-status -i kde | \
grep-dctrl -sPackage,Version -FStatus 'install ok installed'

grep-dctrl and friends are very useful tools indeed.

-- 
Colin Watson [EMAIL PROTECTED]



Re: Getting a list of installed packages

2000-11-15 Thread David Wright
Quoting Robert Guthrie ([EMAIL PROTECTED]):
 On Wednesday 15 November 2000 11:43, Moritz Schulte wrote:
  Robert Guthrie [EMAIL PROTECTED] writes:
   I'm using this command:
   dpkg -l * | egrep ^ii | grep -i kde
 snip
   What I'm trying to get is the full version information.  I only care
   about that and the package name.
 
  You can do it with awk: dpkg -l | awk '{ print $2   $3 }'
 
  moritz
 
 That didn't work either.  It seems that anything I run through a pipe gets 
 truncated.  I'm not sure why.  If I just run dpkg -l all by itself, I get a 
 nicely spaced output that I could cut and past from, but that would require 
 me to do the work that my computer should do for me ;-).  Any suggestions?  
 Running this at the console (as opposed to an X terminal window) doesn't 
 behave any differently.

I'm not sure what you mean by pipes and truncation. The output of
dpkg -l is stuffed into columns whose width appears to be variably-
fixed according to the version/distribution.

If you're to happy fiddle with the output, a better start may be
dpkg -s `dpkg --get-selections | cut -f1` | less
but why bother--- /var/lib/dpkg/status contains all this and more.
You've just got to ignore the paragraphs that don't contain
a Version: line.

Cheers,

-- 
Email:  [EMAIL PROTECTED]   Tel: +44 1908 653 739  Fax: +44 1908 655 151
Snail:  David Wright, Earth Science Dept., Milton Keynes, England, MK7 6AA
Disclaimer:   These addresses are only for reaching me, and do not signify
official stationery. Views expressed here are either my own or plagiarised.



Re: Getting a list of installed packages

2000-11-15 Thread Colin Watson
Moritz Schulte [EMAIL PROTECTED] wrote:
Robert Guthrie [EMAIL PROTECTED] writes:
 I'm using this command:
 dpkg -l * | egrep ^ii | grep -i kde

It seems that 'dpkg -l' (without the pattern) lists all installed
packages, so you don't need to filter the installed packages out.

That's not strictly true; it doesn't list uninstalled packages, but it
will list packages that are half-installed, unconfigured, etc., as well
as held packages and packages marked with some action other than
install. The command above only lists packages that are installed and
marked to install new versions as they appear.

The * is bogus though - it will expand to every filename in the current
directory, which might well not be what you want. Unless you really do
want to expand it, use one of these instead:

  dpkg -l '*'
  dpkg -l *
  dpkg -l \*

-- 
Colin Watson [EMAIL PROTECTED]



Re: Getting a list of installed packages

2000-11-15 Thread John Carline
Robert Guthrie wrote:

 On Wednesday 15 November 2000 11:43, Moritz Schulte wrote:
  Robert Guthrie [EMAIL PROTECTED] writes:
   I'm using this command:
   dpkg -l * | egrep ^ii | grep -i kde
 snip
   What I'm trying to get is the full version information.  I only care
   about that and the package name.
 
  You can do it with awk: dpkg -l | awk '{ print $2   $3 }'
 
moritz

 That didn't work either.  It seems that anything I run through a pipe gets
 truncated.  I'm not sure why.  If I just run dpkg -l all by itself, I get a
 nicely spaced output that I could cut and past from, but that would require
 me to do the work that my computer should do for me ;-).  Any suggestions?

I'm not certain what you mean by truncated (cut off?)  but if you simply mean 
that
you want a nicely formated line try.


dpkg -l | gawk ' /^ii/  /kde/ {printf (%-20.20s %s\n, $2,$3)}'

John

--

Powered by the Penguin





Re: Getting a list of installed packages

2000-11-15 Thread Colin Watson
John Carline [EMAIL PROTECTED] wrote:
Robert Guthrie wrote:
 On Wednesday 15 November 2000 11:43, Moritz Schulte wrote:
  Robert Guthrie [EMAIL PROTECTED] writes:
   dpkg -l * | egrep ^ii | grep -i kde
 
  You can do it with awk: dpkg -l | awk '{ print $2   $3 }'

 That didn't work either.  It seems that anything I run through a pipe gets
 truncated.  I'm not sure why.  If I just run dpkg -l all by itself, I get a
 nicely spaced output that I could cut and past from, but that would require
 me to do the work that my computer should do for me ;-).  Any suggestions?

I'm not certain what you mean by truncated (cut off?)

He means that he sees the following:

ii  ksirc  2.0-final-0.po IRC Client based on QT and KDE
ii  ksirtet2.0-final-0.po Tetris and Puyo-Puyo games for KDE 

... instead of versions 2.0-final-0.potato.3 and 2.0-final-0.potato.2
respectively.

-- 
Colin Watson [EMAIL PROTECTED]



Re: Getting a list of installed packages

2000-11-15 Thread Quietman
On Thu, Nov 16, 2000 at 12:23:07AM +, Colin Watson wrote:
 He means that he sees the following:
 
 ii  ksirc  2.0-final-0.po IRC Client based on QT and KDE
 ii  ksirtet2.0-final-0.po Tetris and Puyo-Puyo games for KDE 
 
 ... instead of versions 2.0-final-0.potato.3 and 2.0-final-0.potato.2
 respectively.
The package name also gets truncated at 14 characters.

-- 
We was playin' the Homestead Grays in the city of Pitchburgh.  Josh [Gibson]
comes up in the last of the ninth with a man on and us a run behind.  Well,
he hit one.  The Grays waited around and waited around, but finally the
empire rules it ain't comin' down.  So we win.  The next day, we was disputin'
the Grays in Philadelphia when here come a ball outta the sky right in the
glove of the Grays' center fielder.  The empire made the only possible call.
You're out, boy! he says to Josh.  Yesterday, in Pitchburgh.
-- Satchel Paige



Re: Getting a list of installed packages

2000-11-15 Thread John Carline
Colin Watson wrote:

 John Carline [EMAIL PROTECTED] wrote:
 Robert Guthrie wrote:
  On Wednesday 15 November 2000 11:43, Moritz Schulte wrote:
   Robert Guthrie [EMAIL PROTECTED] writes:
dpkg -l * | egrep ^ii | grep -i kde
  
   You can do it with awk: dpkg -l | awk '{ print $2   $3 }'
 
  That didn't work either.  It seems that anything I run through a pipe gets
  truncated.  I'm not sure why.  If I just run dpkg -l all by itself, I get a
  nicely spaced output that I could cut and past from, but that would require
  me to do the work that my computer should do for me ;-).  Any suggestions?
 
 I'm not certain what you mean by truncated (cut off?)

 He means that he sees the following:

 ii  ksirc  2.0-final-0.po IRC Client based on QT and KDE
 ii  ksirtet2.0-final-0.po Tetris and Puyo-Puyo games for KDE

 ... instead of versions 2.0-final-0.potato.3 and 2.0-final-0.potato.2
 respectively.


Ahh! I see. You're probably right, but that's caused by the dpkg command isn't 
it -
not the pipe?  Didn't 'dpkg - l'  by itself produce what was wanted?

If the full version is what's needed, it's listed in /var/lib/dpkg/status. The 
dpkg
command cuts it off at 14 characters so the real question may be is there a 
way to
make dpkg  produce the entire version field?

I don't think so, but I could easily be wrong.

John

--

Powered by the Penguin





Re: Getting a list of installed packages

2000-11-15 Thread Michael P. Soulier
On Thu, Nov 16, 2000 at 03:16:47AM +, John Carline wrote:
 
Robert Guthrie [EMAIL PROTECTED] writes:
 dpkg -l * | egrep ^ii | grep -i kde

I'd like to point out here also, that when I tried to uninstall a package,
but it failed due to a dependency problem, the first i changed even though
the package was still installed, because apparently my attempt to remove the
packages changed the first state to a desired of purge. Seems that this isn't 
always the right formula. Perhaps this?

dpkg -l '*' | perl -ne 'print if substr($_,1,1) eq i'

Mike

-- 
Michael P. Soulier [EMAIL PROTECTED]
...the word HACK is used as a verb to indicate a massive amount
of nerd-like effort.  -Harley Hahn, A Student's Guide to UNIX
PGP Public Key: http://www.storm.ca/~msoulier/personal.html


pgp86gqw9gDGF.pgp
Description: PGP signature