Pak: Pacman In Color And More
From ArchWiki
Contents |
Introduction
NOTE: Pak is no longer being actively developed. It has been superceded by psearch which can be found in AUR (link).
One of of the best features, if not the best feature, of Arch Linux is it's package manager: pacman. However, when searching for packages, pacman's output can be far from desirable at times. It's fast, but what if your search returns 200 results? Is the particular pacakage installed already? Is it the most current version? That's why pak was created.
What is pak?
Pak is a program written in bash and Java that manipulates pacman's output in the vein of Gentoo's esearch, though it's not a carbon-copy by any means. It's capabilities, as explained in more detail below, include a long or short output of package information including repository/package name, current version, version installed, download size, and package description--all in a nicely formatted and colored output. Using pak also gives you the ability to search only a single repository, to omit a keyword, or both. Pak can also limit your search to only installed packages, not installed packages, or upgradeable packages.
How does it work?
Pak reads your repositories from /etc/pacman.conf (every repository in brackets and uncommented), performs a pacman -Ss for your keyword, reads and converts the filesize listed in the packages desc file (located in /var/lib/pacman/(repository)/(packagename)-(version)), and reads the description from the same file. Pak now also search AUR using wget.
What are it's benefits?
- Output is easier to read.
- Shows the package version installed, if installed.
- Not all repositories have to be searched.
- A keyword can be omitted from the results.
- Search can be restricted to only installed, not installed, or upgradeable packages.
- Search AUR without using a web browser.
What are it's downsides?
- It takes about twice as long as doing a regular pacman -Ss (only a few seconds, though).
- It takes up more screen real estate.
Where can I get it?
Download the tarball from AUR here. You can use the included PKGBUILD to install the package, or you can install it manually by executing the following:
tar zxvf pak.tar.gz cd pak chmod a+x pak mkdir /usr/share/Pak cp pak /usr/bin cp Pak.jar /usr/share/Pak
This will place the bash script in a universally executeable directory (/usr/bin) and JAR file in it's classpath.
Usage
There are four possible arguments you can give pak, but only three can be used at once.
-s and -l: output format
The most basic usage is a search using the argument -s or -l (short output or long output):
pak -s packageiamlookingfor OR pak -l packageiamlookingfor
-r: single out a repository
Let's say you're doing a search that returns an extraneous amout of results (searching for gnome or kde, for example.) Using the -r argument has pak only search in a repository that you choose. So, if you want to do a search for gnome but only want to search the current repository then:
pak -s gnome -r current
-o: omit a keyword
But you're still getting too many results, right? Well, you can use the argument -o to omit a keyword. Let's say you want to do a search for kde only in the extra repository, and you're still bombarded with extraneous results because of the large amount of international language packages. Try this:
pak -s kde -r extra -o localization
Since the keyword localization is found in the description of the kde international language packs, they are omitted from the results.
Appending i, n, or u to -s and -l
By appending i, n, or u to the -s or -l argument, you can have pak show only installed packages, not installed packages, or upgradable packages. For example:
pak -su gnome
This will performs pak's search for Gnome, but only displays packages that are not installed on your machine.
Using -su or -lu may be useful if you have downgraded packages or if you use the testing repository and want to search packages that you have installed that are also in the testing repository.
Please note that performing a search in this manner does not decrease search time; pak takes the exact same steps it would if you were just using a simple -s or -l, but output will be omitted if the package doesn't match your specification
One last word about arguments
The first argument that you give pak must be -s or -l. After that, the order of -r and -o is interchangeable if you use both arguments.
Pak requirements
Pak was originally written in bash, but due to how slow the script worked it was rewritten and coded in Java with a little bit of bash scripting to fire it up. Therefore, bash is still required as well as the Java Runtime Environment (J2RE or JRE). wget is also now required in order to search AUR.
Fixes and updates
- 10/01/06 - Fix: Fixed a problem some users had with $COLUMNS not being exported. $COLUMNS is now replaced by `tput cols` to hopefully remedy this.
- 09/25/06 - Update: Pak now searches AUR (up to 200 results)
- 09/15/06 - Update: HUGE update. Pak completely rewritten. It now uses just a little bit of bash scripting while all of the heavy duty stuff is left to Java. This will speed things up for you quite a bit.
- 09/06/06 - Update: Replaced all awk commands with cut commands in an attempt to make pak run at least a little bit faster. Also added the ability to search only installed packaged, not installed packages, or upgradeable packages (see above for more details)
- 09/02/06 - Fix: A grep pattern was modified to make the installed version check more failsafe.
- 09/01/06 - Fix: The wildcard during the installed version check caused problems on some systems. The block of code was rewritten using pacman parameters to solve this.
- 08/30/06 - Update: Added the name of the repository that is being actively searched to the "> Searching..." ouput, instead of just "..."
- 08/30/06 - Fix: Fixed some conditionals that sometimes caused a binary operator expected error.
Note
If you have a suggestion or have encountered a bug, please don't hesitate to contact me at wrythe <at> gmail <dot> com.