When I do an apt search, I already know what I'm looking for and what I'm looking at. Which might explain why I prefer the condensed version. I also have a preference for high data-density. Fit as much usable information on the screen as can be reasonably processed.
Anyhow, that probably explains it. I know what I'm looking for when I search - I'm just looking for things like to ensure it exists and that I spell it properly.
That's fair enough.
When scripting, or making more complex searches, that require a lot of filtering - I always use
because the output for each package is on a single line - containing the package name and the package description. So it works better with the other standard UNIX tools (grep, awk, sed etc.).
splits the output over two lines.
The first line is the name of the package, the version number and the install status (if installed).
And the second line is the description.
But if you use
for more complex searches, using grep to filter the results - some of your results will be names of packages but with no description. And other results will be the description, but no package name.
So for example, if I want to find out the names of any python library packages that can deal with LaTex.
If I use the following
apt search python --names-only | \grep -i latex
NOTE: I'm using
above in order to "escape" any aliases that have been set for grep.
On my system grep is aliased to 'grep --color=auto -n', which colourises output AND includes line-number information. We don't want the line-number information to be included, so using
will bypass the alias and will just run plain
using only the parameters that are specified.
In this case
, for a case-insensitive search.
Anyway, using that query - I get the following results:
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
python-latexcodec-doc/stable 2.0.1-1 all
LaTeX lexer and codec library for Python (docs)
LaTeX document processing framework in Python - documentation
python3-flatlatex/stable 0.8-1.1 all
Python3 LaTeX math converter to unicode text - library
Module to embed LaTeX equations in HTML files
python3-latexcodec/stable 2.0.1-1 all
LaTeX lexer and codec library for Python3
LaTeX document processing framework in Python - modules
Embed Sage code and plots into LaTeX -- Python 3
sphinx extensions for working with LaTeX math - Python
In the above, we can see that we have a couple of package names with their descriptions.
But we also have some package descriptions with no names. So the results aren't particularly useful.
Also of note, there is the warning at the top of the output - "WARNING: apt does not have a stable CLI interface. Use with caution in scripts."
apt-cache search python --names-only | \grep -i latex
We get some much more useful output:
python3-flatlatex - Python3 LaTeX math converter to unicode text - library
python3-gleetex - Module to embed LaTeX equations in HTML files
python-plastex-doc - LaTeX document processing framework in Python - documentation
python3-plastex - LaTeX document processing framework in Python - modules
python-latexcodec-doc - LaTeX lexer and codec library for Python (docs)
python3-latexcodec - LaTeX lexer and codec library for Python3
python3-sagetex - Embed Sage code and plots into LaTeX -- Python 3
python3-texext - sphinx extensions for working with LaTeX math - Python
With the above output - I could easily process the results further - by piping to sed, or awk to yield only the package names.
So by using
- you can see that I could easily create a bash one-liner, or a script that could identify all packages that meet certain criteria, compile a list of package names and then install all of those packages in one go.
Or if I wanted to, I could create a more complicated script that would compile a list of packages and will allow me to mark/choose which packages I wanted to install (if any).
But generally speaking though, I usually just pipe the output of
one or two times to refine my searches and then pipe the final output to
, or a pager like
, so I can see exactly which packages are available. And then I'll manually install the ones that I want/need via