apt: the unified one

ubuntu_apps_compFor those who aren’t aware of it, Ubuntu 14.04.3 already has a partially unified apt package. This is a welcome change to simplify the apt family of commands.

For example, the following command works:

$ sudo apt install leafpad

Other simplified commands:

$ apt install package(s)
  -> replaces apt-get install package
$ apt remove package(s)
  -> replaces apt-get remove package
$ apt search query
  -> replaces apt-cache search query
$ apt show package(s)
  -> replaces apt-cache show package(s)
$ apt update
  -> replaces apt-get update
$ apt upgrade
  -> replaces apt-get upgrade
$ apt list –installed
  -> replaces dpkg –get-selections | grep -v deinstall
  -> replaces dpkg -l
$ apt list –upgradable (sudo not required)
  -> replaces apt-get -u upgrade –assume-no (sudo required)
$ apt edit-sources
  -> replaces echo 'text' | sudo tee -a /etc/apt/sources.list
  -> replaces sudo nano /etc/apt/sources.list

However, the process is not complete. Options like autoremove doesn’t work yet.

The good news is, Linux Mint has been working on some python wrapper scripts to make this happen. The following work at the time of writing:

$ apt autoclean
  -> replaces apt-get install package
$ apt autoremove
  -> replaces apt-get remove package
$ apt purge package(s)
  -> replaces apt-get remove –purge package(s)
$ apt depends package(s)
  -> replaces apt-cache depends package(s)
$ apt rdepends package(s)
  -> replaces apt-rdepends package(s)
$ apt policy package(s)
  -> replaces apt-cache policy package(s)
$ apt held
  -> replaces dpkg –get-selections | grep hold
$ apt hold package
  -> replaces echo package hold | sudo dpkg –set-selections
$ apt unhold package
  -> replaces echo package install | sudo dpkg –set-selections
$ apt download package (downloads the deb file of a package)
  -> replaces LC_ALL=C apt-cache depends package |grep -v “Conflicts:\|Replaces:”|awk ‘{print $NF}’|sed -e ‘s/[<>]//g’|xargs aptitude download -r

The scripts work great on Mint and we tried them out on Ubuntu. To get the scripts, run:

$ wget https://raw.githubusercontent.com/linuxmint/mintsystem/master/usr/local/bin/apt
$ chmod +x apt
$ sudo mv apt /usr/local/bin/aptr
$ wget https://github.com/linuxmint/mintsystem/raw/master/usr/local/bin/highlight
$ chmod +x highlight
$ sudo mv highlight /usr/local/bin/

Note that we changed the file name to aptr to avoid conflicts.

Some options depend internally on aptitude or Mint package source specific files. For example:

$ aptr search leafpad
sh: 1: aptitude: not found

However, most of the regular options work with this script.


apt 1.1 comes with many unification features. Ubuntu 15.10 and 16.04 users can install it using:

$ sudo add-apt-repository ppa:deity/sid
$ sudo apt-get update
$ sudo apt-get install apt

3 thoughts on “apt: the unified one”

  1. Two days ago, the new APT 1.1 was accepted into Debian Unstable https://packages.qa.debian.org/a/apt/news/20151126T155413Z.html.

    I don’t remember where I’ve read about it, but it even supports installing local packages with full resolution support! Well, it was about time. Now we won’t need to use `dpkg -i package.deb` and then run `apt-get -f install` to fix the broken system. There was Gdebi already, but I didn’t like it 😛

Leave a Reply

Your email address will not be published. Required fields are marked *