I installed LMDE Gnome edition three days ago, and noticed that 'apt' utility (the Linux Mint specific one, not apt-get and friends) lacks bash completion. Today I wrote a simple bash-completion script for it (mostly by copy-pasting code from 'apt' and 'dpkg' completion scripts). It can complete names of commands, packages and dpkg file names (in case of "deb" command). I thought someone may find it useful. If you want to give it a try, just copy&paste the following code to some editor (like 'gedit'), save it and then copy it to /etc/bash_completion.d directory as root, for example using the following command in terminal:
sudo cp apt-linux-mint /etc/bash_completion.d
(assuming that you saved script as "apt-linux-mint")
After opening new terminal window (or new tab in terminal) completion should work for 'apt'.
- Code: Select all
# Bash completion file for Linux Mint apt utility.
have apt &&
local cur opt
# Completion of commands.
if [[ $COMP_CWORD == 1 ]]; then
COMPREPLY=( $(compgen -W '\
autoclean autoremove build build-dep changelog check clean \
contains content deb depends dist-upgrade download \
dselect-upgrade held help hold install policy purge rdepends \
reinstall remove search show source sources unhold update \
upgrade version' "$cur" ) )
# Completion of command parameters.
case $opt in
# Commands which require filename.
# Note: "search" command does not necessarilly require
# filename, it can accept any pattern, but I put it in this
# group in order to allow filename-completion for this command.
# Commands which require .deb/.udeb file name.
# Commands which require package name.
COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \
2> /dev/null ) )
# Commands which require name of installed package.
if [ -f /etc/debian_version ]; then
# Debian system
COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
# assume RPM based
complete -F _apt apt