How To Get Sorted Output From apt-cache
One annoying thing about Debian is that apt-cache
prints the list of packages unordered.
One can, of course, pipe the output to
sort, but having to do this every time
I looked into what it would take to have the output be ordered by the utility. Turns out, not a lot.
Here is how to rebuild your apt with this patch.
# means a root shell,
% means an unprivileged user's shell.
Install dependencies as root, or use sudo:
# apt-get build-dep apt
Create a new directory and change to it, then get apt's source:
% apt-get source apt
Get and apply the patch:
% cd apt-* % wget http://bsdpower.com/apt-cache-sorted-output/apt-cache-sorted-output-patch.diff % patch -p1 <apt-cache-sorted-output-patch.diff
Build the new apt:
The build will fail at the end with a failure to sign the package. Ignore the error and navigate up one level where you will find several .deb files. Install apt_.deb:
# dpkg -i apt_*.deb
Enjoy sorted output from apt-cache.