2

aptitude (the less-user-hostile wrapper on apt-get, for you oldsters), searches and prints too much when it finds packages. If I only want to see package names, what type?

I suppose a clever cut could do it.

  • Look up attitude. :) – Xavierjazz Oct 11 '14 at 2:40
  • You could try dpkg --get-selection instead, or dpkg -l for a little more information. dpkg --get-selections|sed 's/ *install$//' will give you just the package names. – AFH Oct 11 '14 at 10:55
3

You don't need to pipe the output to any other command. You can change the output format of aptitude with the -F switch. To just print the package names use -F%p.

aptitude search foo -F%p
  • Absolutely the right answer. Fiddling with cut, awk etc. here makes no sense. – Marki Dec 25 '17 at 16:31
1
$ aptitude search mboxgrep | awk '{print $2}'
mboxgrep
mboxgrep:i386

Or,

$ aptitude search fgrep | cut -c5-35
pdfgrep                        
pdfgrep:i386
  • tx that's sick. & AFH's comment won't hurt folks who e-search into here – Phlip Oct 11 '14 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.