Score:2

How does `apt-cache` work?

in flag

Please forgive the stupidity of this question as I am a Linux/Ubuntu noob.

I came across the apt-cache search command in another question while searching for ways to get the LaTeX href package to work on my virtual Ubuntu machine.

I then tried apt-cache search href and got the following output:

libio-dirent-perl - Perl module for accessing dirent structs returned by readdir
libclass-std-storable-perl - Support for creating serializable "inside-out" classes
libconfig-inihash-perl - Perl extension for reading and writing INI files
libdata-dumper-compact-perl - vertically compact width-limited data formatter
libdbix-abstract-perl - DBI SQL abstraction
libdigest-md5-file-perl - Perl extension for getting MD5 sums for files and urls
libhtml-html5-outline-perl - implementation of the HTML5 Outline algorithm
libhtml-microformats-perl - parse microformats in HTML
libjs-autolink - JavaScript methods converting text to links
libjson-hyper-perl - extract links from JSON via a schema
libjson-path-perl - search nested hashref/arrayref structures using JSONPath
libmoosex-arrayref-perl - blessed arrayrefs with Moose
libmoosex-oneargnew-perl - Moose role that extends class' constructor to accept single arguments
libmoosex-param-perl - simple Moose role providing a standard param method
libmoosex-singlearg-perl - module to instantiate Moose objects using a single argument
libmoosex-types-structured-perl - Moose extension for type constraints on structured types
libparams-validationcompiler-perl - module to build an optimized subroutine parameter validator
libpod-spell-perl - formatter to easily check the spelling of POD
libpostfix-parse-mailq-perl - module to parse the postfix mail queue
libtest-deep-unorderedpairs-perl - Test::Deep plugin for comparing lists as if they were hashes
libxml-atom-microformats-perl - parse microformats in Atom content
libxml-libxml-debugging-perl - get debugging information from XML::LibXML
node-url-to-options - Convert a WHATWG URL to an http(s).request options object
roffit - convert nroff manual pages into HTML
tea - graphical text editor with syntax highlighting
texlive-latex-extra - TeX Live: LaTeX additional packages

The string href can only be found in the following package:

libjson-path-perl - search nested hashref/arrayref structures using JSONPath

My understanding was that apt-cache search pattern would identify only packages where pattern is found.

Why is it that href does not occur in the identified packages?

uz flag
Jos
The `apt-cache` command searches for packages that are part of the Debian package system. LaTeX packages are different and are meant to be installed using TeX's own package manager. BTW I can't find a LaTeX package named `href`, but there is one called `hyperref`. Is that the one you need?
Score:2
zw flag

Please note that https://www.ctan.org/pkg/href returns 404. So you are probably using wrong package name. But hyperref package exists.

If you read man apt-cache locally or online you can see the following:

search regex...
search performs a full text search on all available package lists for the POSIX regex pattern given, see regex(7). It searches the package names and the descriptions for an occurrence of the regular expression and prints out the package name and the short description, including virtual package names. If --full is given then output identical to show is produced for each matched package, and if --names-only is given then the long description is not searched, only the package name and provided packages are. Separate arguments can be used to specify multiple search patterns that are and'ed together.

So you can try to use apt-cache search href latex or some logical commands. But real thing which matters is that apt-cache knows nothing about package contents.
LaTeX packages are usually have *.bst, *.sty files for their definitions.

To search package contents for example for hyperref.sty you need to use other tools:

  • locally - use apt-file:

    sudo apt-get install apt-file
    sudo apt-file update
    

    to get something like

    $ sudo apt-file search hyperref.sty
    latexml: /usr/share/perl5/LaTeXML/Package/hyperref.sty.ltxml
    texlive-lang-arabic: /usr/share/texlive/texmf-dist/tex/xelatex/bidi/bidituftehyperref.sty
    texlive-latex-base: /usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty
    texlive-latex-base: /usr/share/texlive/texmf-dist/tex/latex/hyperref/nohyperref.sty
    texlive-latex-extra: /usr/share/texlive/texmf-dist/tex/latex/hobsub/hobsub-hyperref.sty
    texlive-latex-extra: /usr/share/texlive/texmf-dist/tex/latex/interfaces/interfaces-hyperref.sty
    texlive-latex-extra: /usr/share/texlive/texmf-dist/tex/latex/zref/zref-hyperref.sty
    texlive-latex-recommended: /usr/share/texlive/texmf-dist/tex/latex/lwarp/lwarp-hyperref.sty
    

    or with regexp syntax:

    $ sudo apt-file search --regexp hyperref.sty$
    texlive-lang-arabic: /usr/share/texlive/texmf-dist/tex/xelatex/bidi/bidituftehyperref.sty
    texlive-latex-base: /usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty
    texlive-latex-base: /usr/share/texlive/texmf-dist/tex/latex/hyperref/nohyperref.sty
    texlive-latex-extra: /usr/share/texlive/texmf-dist/tex/latex/hobsub/hobsub-hyperref.sty
    texlive-latex-extra: /usr/share/texlive/texmf-dist/tex/latex/interfaces/interfaces-hyperref.sty
    texlive-latex-extra: /usr/share/texlive/texmf-dist/tex/latex/zref/zref-hyperref.sty
    texlive-latex-recommended: /usr/share/texlive/texmf-dist/tex/latex/lwarp/lwarp-hyperref.sty
    
  • online by visiting https://packages.ubuntu.com and searching for hyperref.sty - it is contained in texlive-latex-base Ubuntu package.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.