Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[FAQF] GF3: How do I get a list of installed packages?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20048

PostPosted: Sat Nov 23, 2002 4:18 am    Post subject: [FAQF] GF3: How do I get a list of installed packages? Reply with quote

This is the feedback thread for GF3: How do I get a list of installed packages?.
_________________
Quis separabit? Quo animo?


Last edited by pjp on Thu Jan 16, 2003 10:19 pm; edited 1 time in total
Back to top
View user's profile Send private message
rojaro
l33t
l33t


Joined: 06 May 2002
Posts: 732

PostPosted: Sat Nov 23, 2002 10:59 am    Post subject: Reply with quote

what about /usr/lib/portage/bin/pkglist ...?
_________________
A mathematician is a machine for turning coffee into theorems. ~ Alfred Renyi (*1921 - †1970)
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20048

PostPosted: Mon Nov 25, 2002 3:20 pm    Post subject: Reply with quote

Didn't know about that. Interesting, that by default, /usr/lib/portage/bin/ is not in the PATH. I wonder why.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
securiteaze
Tux's lil' helper
Tux's lil' helper


Joined: 24 Oct 2002
Posts: 77
Location: Tulsa,Oklahoma

PostPosted: Tue Dec 03, 2002 10:13 pm    Post subject: Reply with quote

You could also use 'epm' an rpm workalike for Gentoo Linux
Install it :
Code:
emerge sync && emerge epm

List all installed packages :
Code:
epm -qa

Determine what package provides a file :
Code:
epm -qf /usr/bin/host
bind-tools-9.2.1

_________________
Blah..
Back to top
View user's profile Send private message
janneand
n00b
n00b


Joined: 13 Sep 2002
Posts: 48
Location: Stockholm, Sweden

PostPosted: Wed Dec 04, 2002 4:13 pm    Post subject: Reply with quote

You think the solutions above are too slow? Try this -

Code:
find /var/db/pkg/ -mindepth 2 -maxdepth 2 -printf "%P\n"


If you prefer them wihtout the leading group, use %f instead of %P.

TIPS: Add this to you ~/.bashrc
Code:
alias listinstalled='find /var/db/pkg/ -mindepth 2 -maxdepth 2 -printf "%P\n"'

Save it and...
Code:
source ~/.bashrc

-J
Back to top
View user's profile Send private message
S_aIN_t
Guru
Guru


Joined: 11 May 2002
Posts: 488
Location: Ottawa

PostPosted: Thu Dec 05, 2002 10:27 am    Post subject: Reply with quote

thanks for the find alias. that works much faster than qpkg.. :D
Back to top
View user's profile Send private message
janneand
n00b
n00b


Joined: 13 Sep 2002
Posts: 48
Location: Stockholm, Sweden

PostPosted: Thu Dec 05, 2002 11:01 am    Post subject: Reply with quote

I continued to hack a little bit on that command and came up with this, called qportage. The idea is to be faster than qpkg.

To get this to work - paste it into a file, watch so you don't get a space after the EOF-line and append all lines separated by \.

EDIT:
New version has been added as an ebuild to Bugzilla, Bug#: 11637. Now support for listing files in installed ebuilds, colors and extra information (homepage and ebuild description).

-J

Code:
#!/bin/bash
# Copyright 2002 Jan Andersson
# Distributed under the terms of the GNU General Public License v2

usage() {
  cat <<EOF
Tool to quickly list ebuilds in Gentoo.

qportage [options...] [filters...]

Parameters without option specifiers are filtering the output.

Options:
  -h       Show this help
  -i       List installed packages only
  -v       List and print all versions
  -g       Hide group name

Examples:

# qportage
List all available ebuilds.

# qportage -i dev
List everything installed that is dev-related.

# qportage -vig ^glib-
List available versions of glib.

# qportage quake doom
List available quake and doom packages.
EOF
}

TEMP=`getopt -o igvh --long help -n 'qportage' -- "$@"`

if [ $? != 0 ]
then
   exit 1
fi

eval set -- "$TEMP"
group=1

while true
do
   case "$1" in
      -h|--help)
         usage; exit;;
      -g)
         unset group; shift;;
      -v)
         version=1; shift;;
      -i)
         installed=1; shift;;
      --) shift; break;;
      *) echo "Internal error."; exit 1;;
   esac
done

if [ -z $1 ]
then
   filter=".?"
else
   for f in $@
   do
      filter="$filter --regexp=$f"
   done
fi

if [ $group ]
then
   field=P
else
   field=f
fi

if [ $installed ]
then
   if [ $version ]
   then
      find /var/db/pkg -mindepth 2 -maxdepth 2 -printf \
         "%$field\n"|grep $filter|sort
   else
      find /var/db/pkg -mindepth 2 -maxdepth 2 -printf \
         "%$field\n"|awk -F- '
      {
         # Remove version
         for (i=1; i <= NF; i++) {
            if ($i ~ /^[0-9]/)
               break;
            if (i>1)
               printf "-";
            printf $i;
         }
         printf "\n";
         next;
      } '|grep $filter|sort|uniq
   fi
else
   if [ $version ]
   then
      find /var/cache/edb/dep -mindepth 2 -maxdepth 2 -printf \
         "%$field\n"|grep $filter|sort
   else
      if [ $group ]
      then
         find /usr/portage -type d -mindepth 2 -maxdepth 2 \
            -printf  "%P\n"|awk -F/ '
         {
            # Print only real ebuilds (and not packages etc)
            if ($1 ~ /-/)
               printf $1 "/" $2 "\n"
         }'|grep $filter|sort|uniq
      else
         find /usr/portage -type d -mindepth 2 -maxdepth 2 \
            -printf "%P\n"|awk -F/ '
         {
            # Print only real ebuilds (and not packages etc)
            if ($1 ~ /-/)
               printf $2 "\n"
         } '|grep $filter|sort|uniq
      fi
   fi
fi
Back to top
View user's profile Send private message
Beefrum
Apprentice
Apprentice


Joined: 23 May 2006
Posts: 234

PostPosted: Thu Jun 29, 2006 1:35 am    Post subject: Reply with quote

Code:
# Build Gentoo version file

equery l > version

# Build Gentoo world file

equery -C -q list | cut -d ' ' -f 5 | sed -n 's/-[0-9]\{1,\}.*$//p' > world

_________________
:? Give adaptive answers to unknown problems!
Back to top
View user's profile Send private message
beatryder
Veteran
Veteran


Joined: 08 Apr 2005
Posts: 1138

PostPosted: Thu Jun 29, 2006 3:58 am    Post subject: Reply with quote

pjp wrote:
Didn't know about that. Interesting, that by default, /usr/lib/portage/bin/ is not in the PATH. I wonder why.


That file does not exist on my compy... running portage 2.1
_________________
Dont make it idiot proof, make it work.
Neucode.org
<suppressed key>
Back to top
View user's profile Send private message
kallamej
Administrator
Administrator


Joined: 27 Jun 2003
Posts: 4975
Location: Gothenburg, Sweden

PostPosted: Thu Jun 29, 2006 8:37 am    Post subject: Reply with quote

beatryder wrote:
pjp wrote:
Didn't know about that. Interesting, that by default, /usr/lib/portage/bin/ is not in the PATH. I wonder why.


That file does not exist on my compy... running portage 2.1

Well, the post you quoted is over 3½ years old. IIRC, it was gone also in the later 2.0.x versions.
_________________
Please read our FAQ Forum, it answers many of your questions.
irc: #gentoo-forums on irc.libera.chat
Back to top
View user's profile Send private message
beatryder
Veteran
Veteran


Joined: 08 Apr 2005
Posts: 1138

PostPosted: Thu Jun 29, 2006 2:57 pm    Post subject: Reply with quote

kallamej wrote:
beatryder wrote:
pjp wrote:
Didn't know about that. Interesting, that by default, /usr/lib/portage/bin/ is not in the PATH. I wonder why.


That file does not exist on my compy... running portage 2.1

Well, the post you quoted is over 3½ years old. IIRC, it was gone also in the later 2.0.x versions.


:lol: :oops: hehe, that'll learn me to read post dates I guess :p
_________________
Dont make it idiot proof, make it work.
Neucode.org
<suppressed key>
Back to top
View user's profile Send private message
geophotog
n00b
n00b


Joined: 10 Aug 2006
Posts: 2

PostPosted: Thu Aug 10, 2006 10:02 pm    Post subject: list installeld packages Reply with quote

qpkg has been deprecated and replaced with "equery" in current gentoolkit
Back to top
View user's profile Send private message
Dralnu
Veteran
Veteran


Joined: 24 May 2006
Posts: 1919

PostPosted: Thu Aug 10, 2006 10:29 pm    Post subject: Reply with quote

To get a quick list of installed packages:

eix -I >> installed_apps

If you keep your database updated (daily cronjob of update-eix), that will list everything REAL fast.

Also, you could also cat the file, and if you want,

eix -vI >> installed_apps

to give you a good listing of all your installed files with nice little descriptions of which you can then cat && grep through for a refrence from then on.

Enjoy.

P.S. You could run update_eix && eix -vI >> /path/to/file to keep an updated list handy. Personally, I drop those files in my /home/user dir, and then I can just cat from there. Makes things rahter quick :)
_________________
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
Back to top
View user's profile Send private message
PLum
Tux's lil' helper
Tux's lil' helper


Joined: 20 May 2004
Posts: 108
Location: /dev/world/poland/gliwice

PostPosted: Sun Mar 16, 2008 1:31 am    Post subject: Reply with quote

im really happy that i find that post here
i need to make almost same gentoo server but on really difrent machine and i use
Code:

update-eix
eix -I|grep "\[I\]"| cut -d\  -f2

and that make me a list of packages to emerge on the new machine.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Sun Mar 16, 2008 10:45 am    Post subject: Reply with quote

Awakening dead threads again?

Meanwhile there is "qlist -I". And since quite a while also eix doesn't need posprocessing for what you want:
Code:
eix -I --only-names
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Thu Jun 21, 2012 12:48 pm    Post subject: Reply with quote

More necromancy!

If eix is installed (current version 0.23.10) then the following can be used:

Code:
eix-installed ALL

The resulting list is practically instantanious, but obviously this due the fact that eix uses a cache and therefore 'eix-update' will need to be run to keep this cache up-to-date.

best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum