mpapt -- APT high-level package management frontend


mpapt [command]


mpapt is a command-line tool to query and manage Debian packages. It can work in two modes - interactive (if called without parameters) and batch mode when the parameter is interpreted as a mpapt command to be executed. mpapt operates on a buffer consisting packages matching specified criteria. User can populate buffer using query command and then operate on it with other commands (ex. print its contents with buffer command, install packages with get -b or remove with rm -b). Package installation and removal is logged in /var/log/mpapt.log file. The log-file path and other settings can be changed with set command or by editing /etc/mpapt.conf or ~/.mpapt.conf files. mpapt can perform following actions:

query - query packages database and populate buffer,
buffer - buffer operations (print pkg. information etc.),
get - install packages (like apt-get install),
rm - remove packages (like apt-get remove --purge),
update - update packages database (like apt-get update),
upgrade - upgrade packages (like apt-get upgrade),
help - print help,
reload - reload apt cache data (use after commands which change packages states like get, rm or upgrade),
shell - execute shell command,
debget - install .deb files (like dpkg -i),
alias - create command alias or print existing ones,
set - print, change or save mpapt settings,
exit - quit mpapt,

If configuration option try_shell is set mpapt will try to execute unknown commands interpreting them as the shell ones.

Command syntax

Every mpapt command is built from command name, options and parameters. Command string can consist back-quoted strings (`cmd`) which will be executed as a shell command and replaced by its output. mpapt command output is by default printed on the screen but with pipeline character (|) can also be passed to an arbitrary shell command. Special characters (like back-quote) preceded by backslash (\) will be treated literally. Quotes (" and ') can be used to instruct mpapt to interpret literally a whole string (e.x whitespace as a part of an option or parameter). Commands, options and field expressions may be abbreviated to an unambiguous form. Different commands separated by ; character can be placed in one line. Command aliases can be created with alias command. In interactive mode pressing <Tab> key will auto-complete commands, options and field expressions.

Field expressions

query and buffer commands use special syntax to refer to package fields. Field names (and values in query) are placed between { and } like in query {name apt} which searches for packages named "apt" or buffer -p {section} 1 which prints the section package indexed with number one is in. Boolean fields can be negated by preceding its name with ! or not_ string like in query {!installed} which will search for not installed packages. The valid field names are:

name - package name,
version - package version,
installed - is package installed,
upgradable - can package be upgraded,
archive - package archive,
section - package section,
priority - package priority,
essential - is package essential,
architecture - package architecture,
size - installed package size,
pkg_size - package .deb file size,
source - package source,
pkg_file - package file name,
site - location the package was downloaded from,
held - is package held,
maintainer - package maintainer,
index - package index in apt cache,
Dependences fields: provides, depends, pre_depends, suggests, recommends, conflicts, replaces, obsoletes,
Reverse dependences fields: rev_provides, rev_depends, rev_pre_depends, rev_suggests, rev_recommends, rev_conflicts, rev_replaces, rev_obsoletes,
short_description - package short description,
description - package full description,
files - package files
buf_str - package short informations string, used only in buffer command
buf_id - package index in buffer used only in buffer command

Example 1. Examples

Search for installed packages having 'apt' string in name:

              > query {installed} {name #apt} 
Search for packages with name starting with letter 'a' and finished with minus followed by two characters, with size smaller than 10MB, not currently installed, depending on xlibs, having quote character in description, present in testing archive but not present in stable:
              > query {name @a.*-..} {size <10M} {!installed} {depends xlibs}
                {description #\'} {archive testing} {archive !stable} 
Search for packages with named "apt" and print important package data information for package indexed in buffer with number one.
              > query --quiet {name apt}; buffer --info 1
Print package informations for package with umber one in the buffer:
              > buffer --info 1
For packages from 1 to 3 print package header (name, version and archives) and cyan string "Size:" followed by package size and newline. Send output to the less command (-r for correct colors display):
              > buffer --header --print '*c*Size:*n* {size}\n' `seq 3`|less -r
Sum up sizes of all packages in buffer using awk
              > buffer --print {size} | awk \'{c+=$1} END{print c}\'
Install package indexed in buffer with number 4:
              > get --buffer 4
Remove packages found by deborphan:
              > rm `deborphan`
Start midnight commander (if try_shell configuration option is set "mc" command would be enough)
              > shell mc
Create alias named 'nameq' to search for packages with name equal to its first parameter:
              > alias nameq query '{name $1}'
Above commands with common abbreviations:
              > q {inst} {name #apt} 
              > q {na @a.*-..} {size <10M} {!inst} {dep xlibs}
                {desc #\'} {archive testing} {archive !stable} 
              > b -i 1
              > q {na apt}; b -i 0
              > b --head -p '*c*Size:*n* {size}' `seq 3` | less -r
              > b -p {size} | awk \'{c+=$1} END{print c}\'
              > g -b 4
              > rm `deborphan`
              > sh mc
              > al nameq query '{name $1}'


/etc/mpapt.conf - system wide configuration
~/.mpapt.conf - user configuration
/var/log/mpapt.log - default log-file location

See also

mpapt-query(8), mpapt-buffer(8), mpapt-get(8), mpapt-rm(8), mpapt-update(8), mpapt-upgrade(8), mpapt-reload(8), mpapt-shell(8), mpapt-debget(8), mpapt-alias(8), mpapt-set(8), mpapt-exit(8)