TIP Search Portage Tree Using Regular Expressions

From Gentoo Linux Wiki

Jump to: navigation, search
This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other

[edit] 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.

[edit] Regular Expression Basics

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

  • ^ starting with

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

 esearch ^myth
  • $ ending with

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$
  • | means or

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)"
Personal tools