10

I know they think that they are being helpful, but in fact they are being quite the opposite here in the apt --help and manpage:

Much like apt itself, its manpage is intended as an end user interface and as such only mentions the most used commands and options partly to not duplicate information in multiple places and partly to avoid overwhelming readers with a cornucopia of options and details.

So basically in other words they only list a few of the commands and options and give you no idea about how to find out the rest which is greatly unhelpful if I am to use this tool.

So what are all the commands and options that they feel they are being 'helpful' not to provide, what are their details and usage, and how can I keep up-to-date with this information if they do not provide it officially? Or perhaps that has changed now and they are listed somewhere?

I am running Ubuntu GNOME 16.04 with GNOME 3.20.

  • Broad questions like these aren't very suitable for AskUbuntu like sites as was mentioned in the FAQ and thus I'm voting this to close – Anwar Aug 16 '16 at 11:14
  • @AnwarShah: I know what it says, but I'm not sure that this is actually the case for this question, I know some of the wording is similar to what they would categorise as 'too broad', however I am asking a very specific and reasonable question, which may have a relatively short answer depending on how many commands there are. Probably the most helpful thing to be provided would be a link to official documentation with the information if there is in fact such documentation anywhere. –  Aug 16 '16 at 13:33
  • and that will make this question's answers copy of man pages. because apt is apt-get and apt-cache only. – Anwar Aug 16 '16 at 13:48

3 Answers3

7

Please improve this wiki and add your favourite apt commands :)


apt changelog PACKAGE_NAME

The above cmd. hows the changelog history for the specified package in reverse date order (newest first) in less format, pulled from changelogs.ubuntu.com


apt full-upgrade

(requires root privilege) a new name for apt-get dist-upgrade - see man apt-get:

dist-upgrade in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary. The dist-upgrade command may therefore remove some packages.


apt search PACKAGE_NAME

Almost the same as apt-cache search but with prettified output - line-spaced and coloured for easier reading:

search performs a full text search on all available package lists for the POSIX regex pattern given. 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.


apt list -manual-installed -a

More verbose than -v for particular packages


arivero
  • 161
  • 4
Zanna
  • 70,465
6

From the apt(8) manual page:

SCRIPT USAGE AND DIFFERENCES FROM OTHER APT TOOLS
   The apt(8) commandline is designed as an end-user tool and it may change
   behavior between versions. While it tries not to break backward
   compatibility this is not guaranteed either if a change seems beneficial
   for interactive use.

   All features of apt(8) are available in dedicated APT tools like apt-get(8)
   and apt-cache(8) as well.  apt(8) just changes the default value of some
   options (see apt.conf(5) and specifically the Binary scope). So you should
   prefer using these commands (potentially with some additional options
   enabled) in your scripts as they keep backward compatibility as much as
   possible.

My understanding of what this means is that apt is to be used with the options shown in the man page and other apt tools such as apt-get(8) or apt-cache(8) have additional options and functionality available to the end user.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
  • Perhaps this should be added as comment rather than answer as it is too obvious – rancho Aug 15 '16 at 22:58
  • No, apt is not a shortcut to apt-get; they are two separate programs, even if they are closely related. But several of the options provided by man apt-get do apply to apt as well, even if there are differences. For instance, apt upgrade and apt-get upgrade are similar but not identical. – Gunnar Hjalmarsson Aug 15 '16 at 23:15
  • 1
    Thanks, @GunnarHjalmarsson. I edited my answer to clarify the wording. – Antonios Hadjigeorgalis Aug 15 '16 at 23:55
  • 1
    Do you have a reference for this? I had always thought that apt is either a superset of apt-get or that it, at least, has some options that apt-get doesn't even if it lacks some that apt-get has. What makes you think is it s subset only? – terdon Aug 16 '16 at 10:38
  • @terdon, Comparing the man pages, I saw nothing listed for apt that isn't also available from apt-get. And there are many additional options for apt-get. – Antonios Hadjigeorgalis Aug 16 '16 at 12:05
  • @AntoniosHadjigeorgalis yes, but as this question highlights, the man page of apt doesn't show all options. Therefore, that an option is missing from the man page doesn't mean that the relevant feature is missing from apt. Since apt was designed as a replacement for apt-get, I would be very surprised if it is indeed only offering a subset of the former's functionality. – terdon Aug 16 '16 at 12:40
  • @terdon, indeed you are correct. apt contains functionality from both apt-get and apt-cache as well as the apt list which looks to be unique to apt. I have had to change my answer to correct the errors that you have pointed out. – Antonios Hadjigeorgalis Aug 16 '16 at 13:44
  • for one: where in the documentation does it list download and --download-only (1st downloads to current dir and 2nd uses the normal cache location). – Rinzwind Oct 09 '16 at 20:07
  • @Rinzwind man apt-get – Antonios Hadjigeorgalis Oct 09 '16 at 20:11
4

AFAIK, all options can only be found in the completions/bash/apt file of the GitHub apt repository. apt has various generic options and commands. The commands may also have additional options.

Generic options

The generic options of apt are the following:

-d --download-only
-y --assume-yes
--assume-no
-u --show-upgraded
-m --ignore-missing
-t --target-release
--download
--fix-missing
--ignore-hold
--upgrade
--only-upgrade
--allow-change-held-packages
--allow-remove-essential
--allow-downgrades
--print-uris
--trivial-only
--remove
--arch-only
--allow-unauthenticated
--allow-insecure-repositories
--install-recommends
--install-suggests
--no-install-recommends
--no-install-suggests
--fix-policy

Commands

The available commands are the following:

list
search
show|showsrc
install|reinstall|remove|purge|autoremove|autopurge
update
upgrade|full-upgrade|dist-upgrade
edit-sources
help
source|build-dep
clean|autoclean
download|changelog
moo
depends|rdepends
policy

Additional command options

  • For commands install|reinstall|remove|purge|upgrade|dist-upgrade|full-upgrade|autoremove|autopurge the additional options are:

    --show-progress
    --fix-broken
    --purge
    --verbose-versions
    --auto-remove
    -s --simulate --dry-run
    --download
    --fix-missing
    --fix-policy
    --ignore-hold
    --force-yes
    --trivial-only
    --reinstall
    --solver
    -t --target-release
    

    Also the generic apt options.

  • For command update the additional options are:

    --list-cleanup
    --print-uris
    --allow-insecure-repositories
    
  • For command list the additional options are:

    --installed
    --upgradable 
    --manual-installed
    -v --verbose
    -a --all-versions
    -t --target-release
    
  • For command show the additional options are:

    -a --all-versions
    
  • For commands depends|rdepends the additional options are:

    -i --important
    --installed
    --pre-depends
    --depends
    --recommends
    --suggests
    --replaces
    --breaks
    --conflicts
    --enhances
    --recurse
    --implicit
    
  • For command search the additional options are:

    -n --names-only
    -f --full
    
  • For command showsrc the additional option is:

    --only-source
    
  • For command source the additional options are:

    -s --simulate --dry-run
    -b --compile --build
    -P --build-profiles
    --diff-only
    --debian-only
    --tar-only
    --dsc-only
    -t --target-release
    

    Also the generic apt options.

  • For command build-dep the additional options are:

    -a --host-architecture
    -s --simulate --dry-run
    -P --build-profiles
    -t --target-release
    --purge
    --solver
    

    Also the generic apt options.

  • For command moo the additional option is:

    --color
    
  • For commands clean|autoclean the additional options are:

    -s --simulate --dry-run
    
arivero
  • 161
  • 4