Today's article has you playing around with 'apt-cache'.

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
4,513
Reaction score
4,189
Credits
36,208
It's a pretty handy tool on supported operating systems. The package manager in general is pretty mature and I appreciate it. So, here's an article about just apt-cache.


Feedback is awesome.
 


guiverc

Member
Joined
Nov 17, 2021
Messages
23
Reaction score
46
Credits
314
`apt-cache stats`

I didn't know that was there, then again more likely I've read it in the `man` page, run it, then never used it again thus it's forgotten pretty quickly.

Good article; and given I've (& no doubt others) used `apt-cache` so often in support; any description on common tools is always helpful.
 
OP
K

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
4,513
Reaction score
4,189
Credits
36,208
`apt-cache stats`

Yeah, it doesn't really give you anything helpful (at least not that I can think of), but it's there.

Actually, now that I think about it, it might be helpful if you've decided to make local repository mirrors? I've never done that, but it might be useful then if nothing else more than a sanity check.

And, yeah, apt-cache is a pretty solid tool for people to have in their Linux toolbox.

I was just looking (for a conversation elsewhere) and I'm done with my obligations after mid-April 2022. I will no longer be obligated to an article every other day. It seems likely that I'll keep writing them, probably at the same pace, but it'll be nice when I'm no longer obligating myself to do so! :D
 

craigevil

Well-Known Member
Joined
Feb 24, 2021
Messages
286
Reaction score
290
Credits
1,977
Most of the commands with newer Apt do not require the use of apt-cache;
apt search
apt depends
apt rdepends
etc

I use aliases for most apt commands:
Code:
# APT User Commands
alias search='apt search'
alias file='apt-file search'
alias policy='apt policy'
alias show="apt show"
# if user is not root, pass all commands via sudo #
if [ $UID -ne 0 ]; then
alias update='sudo apt update'
alias ainstall='sudo apt install'
alias apurge='sudo apt purge -y --autoremove'
alias upgrade='sudo apt upgrade'
alias aremove='sudo apt autoremove -y'
alias clean='sudo apt clean && sudo apt autoclean'
alias reboot='sudo reboot'
alias shutdown="sudo shutdown -P now"
fi

tldr is nifty:
tldr apt-cache
apt-cache
Debian and Ubuntu package query tool.More information: https://manpages.debian.org/latest/apt/apt-cache.8.html.

- Search for a package in your current sources:
apt-cache search {{query}}

- Show information about a package:
apt-cache show {{package}}

- Show whether a package is installed and up to date:
apt-cache policy {{package}}

- Show dependencies for a package:
apt-cache depends {{package}}

- Show packages that depend on a particular package:
apt-cache rdepends {{package}}
man apt-cache.8 shows all the commands, man I didn't realize there were so many.

apt-cache showpkg is a really useful command. It is one of the few apt-cache commands that requires the use of apt-cache.

Using your example of inxi:
Code:
apt-cache showpkg inxi
Package: inxi
Versions:
3.3.10-1-1 (/var/lib/apt/lists/deb.debian.org_debian_dists_unstable_main_binary-arm64_Packages) (/var/lib/apt/lists/incoming.debian.org_debian-buildd_dists_buildd-unstable_main_binary-arm64_Packages) (/var/lib/dpkg/status)
 Description Language:
                 File: /var/lib/apt/lists/deb.debian.org_debian_dists_unstable_main_binary-arm64_Packages
                  MD5: 13277f07e950aaf291de2de69ab2684c
 Description Language: en
                 File: /var/lib/apt/lists/deb.debian.org_debian_dists_unstable_main_i18n_Translation-en
                  MD5: 13277f07e950aaf291de2de69ab2684c


Reverse Depends:
  forensics-extra,inxi
  xapps-common,inxi
  quassel-data,inxi
Dependencies:
3.3.10-1-1 - pciutils (0 (null)) procps (0 (null)) perl:any (0 (null)) dmidecode (0 (null)) dnsutils (0 (null)) file (0 (null)) hddtemp (0 (null)) iproute2 (16 (null)) net-tools (0 (null)) kmod (0 (null)) lm-sensors (0 (null)) mesa-utils (0 (null)) sudo (0 (null)) tree (0 (null)) usbutils (0 (null)) x11-utils (0 (null)) x11-xserver-utils (0 (null)) libcpanel-json-xs-perl (16 (null)) libjson-xs-perl (0 (null)) libxml-dumper-perl (0 (null)) wget (16 (null)) curl (16 (null)) libhttp-tiny-perl (0 (null))
Provides:
3.3.10-1-1 -
Reverse Provides:
 
OP
K

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
4,513
Reaction score
4,189
Credits
36,208
I use aliases for most apt commands:

I'm not sure about aliases - but they recommend using the apt-foo commands for scripting. There's some information at this link:


That said, my aliases point to 'apt' and not, for example, 'apt-get'.

tldr is nifty:

Darned right, it is. It's on my list of future articles.

There's no way I'm going to get all the articles done (that I want to get done) before the year is over. I'm starting to come to grips with that and though the project ends soon, more articles are bound to be written.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Top