Search:  
Gentoo Wiki

TIP_Search_Portage_Tree_Using_Regular_Expressions

This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other

Searching Portage Tree

There are a number of utilities to search the portage tree, aside from the default options that come with portage (emerge -s and emerge -S)). No matter what method you use though, you can usually use regular expressions to help narrow your search or expand your options.

In our examples, we'll be using both esearch and eix, third-party portage utilities that index the portage tree, and make searching much faster. No matter what command you use to search though, the patterns will work interchangably.

Regular Expression Basics

Before using some regexp magic, there are some basics you should know.

If you wanted to search all programs that start with the word myth then you would do this:

 esearch ^myth

If you wanted to search all programs that end with the word tv then you would do this:

 esearch tv$

You can also use both ^ and $ if you want to search for an exact name.

 esearch ^mythtv$

If you are going to use pipes, then be sure to put your pattern in quotes. This example will search for any ebuilds starting with myth or xaw:

 esearch "^(myth|xaw)"
Retrieved from "http://www.gentoo-wiki.info/TIP_Search_Portage_Tree_Using_Regular_Expressions"

Last modified: Wed, 26 Dec 2007 15:25:00 +0000 Hits: 7,397