1APT-GET(8) APT APT-GET(8)
2
3
4
6 apt-get - APT package handling utility -- command-line interface
7
9 apt-get [-asqdyfmubV] [-o=config_string] [-c=config_file]
10 [-t=target_release] [-a=architecture] {update | upgrade |
11 dselect-upgrade | dist-upgrade |
12 install pkg [{=pkg_version_number | /target_release}]... |
13 remove pkg... | purge pkg... |
14 source pkg [{=pkg_version_number | /target_release}]... |
15 build-dep pkg [{=pkg_version_number | /target_release}]... |
16 download pkg [{=pkg_version_number | /target_release}]... |
17 check | clean | autoclean | autoremove | {-v | --version} |
18 {-h | --help}}
19
21 apt-get is the command-line tool for handling packages, and may be
22 considered the user's "back-end" to other tools using the APT library.
23 Several "front-end" interfaces exist, such as aptitude(8), synaptic(8)
24 and wajig(1).
25
26 Unless the -h, or --help option is given, one of the commands below
27 must be present.
28
29 update
30 update is used to resynchronize the package index files from their
31 sources. The indexes of available packages are fetched from the
32 location(s) specified in /etc/apt/sources.list. For example, when
33 using a Debian archive, this command retrieves and scans the
34 Packages.gz files, so that information about new and updated
35 packages is available. An update should always be performed before
36 an upgrade or dist-upgrade. Please be aware that the overall
37 progress meter will be incorrect as the size of the package files
38 cannot be known in advance.
39
40 upgrade
41 upgrade is used to install the newest versions of all packages
42 currently installed on the system from the sources enumerated in
43 /etc/apt/sources.list. Packages currently installed with new
44 versions available are retrieved and upgraded; under no
45 circumstances are currently installed packages removed, or packages
46 not already installed retrieved and installed. New versions of
47 currently installed packages that cannot be upgraded without
48 changing the install status of another package will be left at
49 their current version. An update must be performed first so that
50 apt-get knows that new versions of packages are available.
51
52 dist-upgrade
53 dist-upgrade in addition to performing the function of upgrade,
54 also intelligently handles changing dependencies with new versions
55 of packages; apt-get has a "smart" conflict resolution system, and
56 it will attempt to upgrade the most important packages at the
57 expense of less important ones if necessary. The dist-upgrade
58 command may therefore remove some packages. The
59 /etc/apt/sources.list file contains a list of locations from which
60 to retrieve desired package files. See also apt_preferences(5) for
61 a mechanism for overriding the general settings for individual
62 packages.
63
64 dselect-upgrade
65 dselect-upgrade is used in conjunction with the traditional Debian
66 packaging front-end, dselect(1). dselect-upgrade follows the
67 changes made by dselect(1) to the Status field of available
68 packages, and performs the actions necessary to realize that state
69 (for instance, the removal of old and the installation of new
70 packages).
71
72 install
73 install is followed by one or more packages desired for
74 installation or upgrading. Each package is a package name, not a
75 fully qualified filename (for instance, in a Debian system,
76 apt-utils would be the argument provided, not
77 apt-utils_2.4.5_amd64.deb). All packages required by the package(s)
78 specified for installation will also be retrieved and installed.
79 The /etc/apt/sources.list file is used to locate the desired
80 packages. If a hyphen is appended to the package name (with no
81 intervening space), the identified package will be removed if it is
82 installed. Similarly a plus sign can be used to designate a package
83 to install. These latter features may be used to override decisions
84 made by apt-get's conflict resolution system.
85
86 A specific version of a package can be selected for installation by
87 following the package name with an equals and the version of the
88 package to select. This will cause that version to be located and
89 selected for install. Alternatively a specific distribution can be
90 selected by following the package name with a slash and the version
91 of the distribution or the Archive name (stable, testing,
92 unstable).
93
94 Both of the version selection mechanisms can downgrade packages and
95 must be used with care.
96
97 This is also the target to use if you want to upgrade one or more
98 already-installed packages without upgrading every package you have
99 on your system. Unlike the "upgrade" target, which installs the
100 newest version of all currently installed packages, "install" will
101 install the newest version of only the package(s) specified. Simply
102 provide the name of the package(s) you wish to upgrade, and if a
103 newer version is available, it (and its dependencies, as described
104 above) will be downloaded and installed.
105
106 Finally, the apt_preferences(5) mechanism allows you to create an
107 alternative installation policy for individual packages.
108
109 If no package matches the given expression and the expression
110 contains one of '.', '?' or '*' then it is assumed to be a POSIX
111 regular expression, and it is applied to all package names in the
112 database. Any matches are then installed (or removed). Note that
113 matching is done by substring so 'lo.*' matches 'how-lo' and
114 'lowest'. If this is undesired, anchor the regular expression with
115 a '^' or '$' character, or create a more specific regular
116 expression.
117
118 Fallback to regular expressions is deprecated in APT 2.0, has been
119 removed in apt(8), except for anchored expressions, and will be
120 removed from apt-get(8) in a future version. Use apt-patterns(5)
121 instead.
122
123 reinstall
124 reinstall is an alias for install --reinstall.
125
126 remove
127 remove is identical to install except that packages are removed
128 instead of installed. Note that removing a package leaves its
129 configuration files on the system. If a plus sign is appended to
130 the package name (with no intervening space), the identified
131 package will be installed instead of removed.
132
133 purge
134 purge is identical to remove except that packages are removed and
135 purged (any configuration files are deleted too).
136
137 source
138 source causes apt-get to fetch source packages. APT will examine
139 the available packages to decide which source package to fetch. It
140 will then find and download into the current directory the newest
141 available version of that source package while respecting the
142 default release, set with the option APT::Default-Release, the -t
143 option or per package with the pkg/release syntax, if possible.
144
145 The arguments are interpreted as binary and source package names.
146 See the --only-source option if you want to change that.
147
148 Source packages are tracked separately from binary packages via
149 deb-src lines in the sources.list(5) file. This means that you will
150 need to add such a line for each repository you want to get sources
151 from; otherwise you will probably get either the wrong (too old/too
152 new) source versions or none at all.
153
154 If the --compile option is specified then the package will be
155 compiled to a binary .deb using dpkg-buildpackage for the
156 architecture as defined by the --host-architecture option. If
157 --download-only is specified then the source package will not be
158 unpacked.
159
160 A specific source version can be retrieved by postfixing the source
161 name with an equals and then the version to fetch, similar to the
162 mechanism used for the package files. This enables exact matching
163 of the source package name and version, implicitly enabling the
164 APT::Get::Only-Source option.
165
166 Note that source packages are not installed and tracked in the dpkg
167 database like binary packages; they are simply downloaded to the
168 current directory, like source tarballs.
169
170 build-dep
171 build-dep causes apt-get to install/remove packages in an attempt
172 to satisfy the build dependencies for a source package. By default
173 the dependencies are satisfied to build the package natively. If
174 desired a host-architecture can be specified with the
175 --host-architecture option instead.
176
177 The arguments are interpreted as binary or source package names.
178 See the --only-source option if you want to change that.
179
180 satisfy
181 satisfy causes apt-get to satisfy the given dependency strings. The
182 dependency strings may have build profiles and architecture
183 restriction list as in build dependencies. They may optionally be
184 prefixed with "Conflicts: " to unsatisfy the dependency string.
185 Multiple strings of the same type can be specified.
186
187 Example: apt-get satisfy "foo" "Conflicts: bar" "baz (>> 1.0) | bar
188 (= 2.0), moo"
189
190 The legacy operator '</>' is not supported, use '<=/>=' instead.
191
192 check
193 check is a diagnostic tool; it updates the package cache and checks
194 for broken dependencies.
195
196 download
197 download will download the given binary package into the current
198 directory.
199
200 clean
201 clean clears out the local repository of retrieved package files.
202 It removes everything but the lock file from
203 /var/cache/apt/archives/ and /var/cache/apt/archives/partial/.
204
205 autoclean (and the auto-clean alias since 1.1)
206 Like clean, autoclean clears out the local repository of retrieved
207 package files. The difference is that it only removes package files
208 that can no longer be downloaded, and are largely useless. This
209 allows a cache to be maintained over a long period without it
210 growing out of control. The configuration option
211 APT::Clean-Installed will prevent installed packages from being
212 erased if it is set to off.
213
214 autoremove (and the auto-remove alias since 1.1)
215 autoremove is used to remove packages that were automatically
216 installed to satisfy dependencies for other packages and are now no
217 longer needed.
218
219 changelog
220 changelog tries to download the changelog of a package and displays
221 it through sensible-pager. By default it displays the changelog for
222 the version that is installed. However, you can specify the same
223 options as for the install command.
224
225 indextargets
226 Displays by default a deb822 formatted listing of information about
227 all data files (aka index targets) apt-get update would download.
228 Supports a --format option to modify the output format as well as
229 accepts lines of the default output to filter the records by. The
230 command is mainly used as an interface for external tools working
231 with APT to get information as well as filenames for downloaded
232 files so they can use them as well instead of downloading them
233 again on their own. Detailed documentation is omitted here and can
234 instead be found in the file
235 /usr/share/doc/apt/acquire-additional-files.md.gz shipped by the
236 apt-doc package.
237
239 All command line options may be set using the configuration file, the
240 descriptions indicate the configuration option to set. For boolean
241 options you can override the config file by using something like
242 -f-,--no-f, -f=no or several other variations.
243
244 --no-install-recommends
245 Do not consider recommended packages as a dependency for
246 installing. Configuration Item: APT::Install-Recommends.
247
248 --install-suggests
249 Consider suggested packages as a dependency for installing.
250 Configuration Item: APT::Install-Suggests.
251
252 -d, --download-only
253 Download only; package files are only retrieved, not unpacked or
254 installed. Configuration Item: APT::Get::Download-Only.
255
256 -f, --fix-broken
257 Fix; attempt to correct a system with broken dependencies in place.
258 This option, when used with install/remove, can omit any packages
259 to permit APT to deduce a likely solution. If packages are
260 specified, these have to completely correct the problem. The option
261 is sometimes necessary when running APT for the first time; APT
262 itself does not allow broken package dependencies to exist on a
263 system. It is possible that a system's dependency structure can be
264 so corrupt as to require manual intervention (which usually means
265 using dpkg --remove to eliminate some of the offending packages).
266 Use of this option together with -m may produce an error in some
267 situations. Configuration Item: APT::Get::Fix-Broken.
268
269 -m, --ignore-missing, --fix-missing
270 Ignore missing packages; if packages cannot be retrieved or fail
271 the integrity check after retrieval (corrupted package files), hold
272 back those packages and handle the result. Use of this option
273 together with -f may produce an error in some situations. If a
274 package is selected for installation (particularly if it is
275 mentioned on the command line) and it could not be downloaded then
276 it will be silently held back. Configuration Item:
277 APT::Get::Fix-Missing.
278
279 --no-download
280 Disables downloading of packages. This is best used with
281 --ignore-missing to force APT to use only the .debs it has already
282 downloaded. Configuration Item: APT::Get::Download.
283
284 -q, --quiet
285 Quiet; produces output suitable for logging, omitting progress
286 indicators. More q's will produce more quiet up to a maximum of 2.
287 You can also use -q=# to set the quiet level, overriding the
288 configuration file. Note that quiet level 2 implies -y; you should
289 never use -qq without a no-action modifier such as -d, --print-uris
290 or -s as APT may decide to do something you did not expect.
291 Configuration Item: quiet.
292
293 -s, --simulate, --just-print, --dry-run, --recon, --no-act
294 No action; perform a simulation of events that would occur based on
295 the current system state but do not actually change the system.
296 Locking will be disabled (Debug::NoLocking) so the system state
297 could change while apt-get is running. Simulations can also be
298 executed by non-root users which might not have read access to all
299 apt configuration distorting the simulation. A notice expressing
300 this warning is also shown by default for non-root users
301 (APT::Get::Show-User-Simulation-Note). Configuration Item:
302 APT::Get::Simulate.
303
304 Simulated runs print out a series of lines, each representing a
305 dpkg operation: configure (Conf), remove (Remv) or unpack (Inst).
306 Square brackets indicate broken packages, and empty square brackets
307 indicate breaks that are of no consequence (rare).
308
309 -y, --yes, --assume-yes
310 Automatic yes to prompts; assume "yes" as answer to all prompts and
311 run non-interactively. If an undesirable situation, such as
312 changing a held package, trying to install an unauthenticated
313 package or removing an essential package occurs then apt-get will
314 abort. Configuration Item: APT::Get::Assume-Yes.
315
316 --assume-no
317 Automatic "no" to all prompts. Configuration Item:
318 APT::Get::Assume-No.
319
320 --no-show-upgraded
321 Do not show a list of all packages that are to be upgraded.
322 Configuration Item: APT::Get::Show-Upgraded.
323
324 -V, --verbose-versions
325 Show full versions for upgraded and installed packages.
326 Configuration Item: APT::Get::Show-Versions.
327
328 -a, --host-architecture
329 This option controls the architecture packages are built for by
330 apt-get source --compile and how cross-builddependencies are
331 satisfied. By default is it not set which means that the host
332 architecture is the same as the build architecture (which is
333 defined by APT::Architecture). Configuration Item:
334 APT::Get::Host-Architecture.
335
336 -P, --build-profiles
337 This option controls the activated build profiles for which a
338 source package is built by apt-get source --compile and how build
339 dependencies are satisfied. By default no build profile is active.
340 More than one build profile can be activated at a time by
341 concatenating them with a comma. Configuration Item:
342 APT::Build-Profiles.
343
344 -b, --compile, --build
345 Compile source packages after downloading them. Configuration Item:
346 APT::Get::Compile.
347
348 --ignore-hold
349 Ignore package holds; this causes apt-get to ignore a hold placed
350 on a package. This may be useful in conjunction with dist-upgrade
351 to override a large number of undesired holds. Configuration Item:
352 APT::Ignore-Hold.
353
354 --with-new-pkgs
355 Allow installing new packages when used in conjunction with
356 upgrade. This is useful if the update of an installed package
357 requires new dependencies to be installed. Instead of holding the
358 package back upgrade will upgrade the package and install the new
359 dependencies. Note that upgrade with this option will never remove
360 packages, only allow adding new ones. Configuration Item:
361 APT::Get::Upgrade-Allow-New.
362
363 --no-upgrade
364 Do not upgrade packages; when used in conjunction with install,
365 no-upgrade will prevent packages on the command line from being
366 upgraded if they are already installed. Configuration Item:
367 APT::Get::Upgrade.
368
369 --only-upgrade
370 Do not install new packages; when used in conjunction with install,
371 only-upgrade will install upgrades for already installed packages
372 only and ignore requests to install new packages. Configuration
373 Item: APT::Get::Only-Upgrade.
374
375 --allow-downgrades
376 This is a dangerous option that will cause apt to continue without
377 prompting if it is doing downgrades. It should not be used except
378 in very special situations. Using it can potentially destroy your
379 system! Configuration Item: APT::Get::allow-downgrades. Introduced
380 in APT 1.1.
381
382 --allow-remove-essential
383 Force yes; this is a dangerous option that will cause apt to
384 continue without prompting if it is removing essentials. It should
385 not be used except in very special situations. Using it can
386 potentially destroy your system! Configuration Item:
387 APT::Get::allow-remove-essential. Introduced in APT 1.1.
388
389 --allow-change-held-packages
390 Force yes; this is a dangerous option that will cause apt to
391 continue without prompting if it is changing held packages. It
392 should not be used except in very special situations. Using it can
393 potentially destroy your system! Configuration Item:
394 APT::Get::allow-change-held-packages. Introduced in APT 1.1.
395
396 --force-yes
397 Force yes; this is a dangerous option that will cause apt to
398 continue without prompting if it is doing something potentially
399 harmful. It should not be used except in very special situations.
400 Using force-yes can potentially destroy your system! Configuration
401 Item: APT::Get::force-yes. This is deprecated and replaced by
402 --allow-unauthenticated , --allow-downgrades ,
403 --allow-remove-essential , --allow-change-held-packages in 1.1.
404
405 --print-uris
406 Instead of fetching the files to install their URIs are printed.
407 Each URI will have the path, the destination file name, the size
408 and the expected MD5 hash. Note that the file name to write to will
409 not always match the file name on the remote site! This also works
410 with the source and update commands. When used with the update
411 command the MD5 and size are not included, and it is up to the user
412 to decompress any compressed files. Configuration Item:
413 APT::Get::Print-URIs.
414
415 --purge
416 Use purge instead of remove for anything that would be removed. An
417 asterisk ("*") will be displayed next to packages which are
418 scheduled to be purged. remove --purge is equivalent to the purge
419 command. Configuration Item: APT::Get::Purge.
420
421 --reinstall
422 Re-install packages that are already installed and at the newest
423 version. Configuration Item: APT::Get::ReInstall.
424
425 --list-cleanup
426 This option is on by default; use --no-list-cleanup to turn it off.
427 When it is on, apt-get will automatically manage the contents of
428 /var/lib/apt/lists to ensure that obsolete files are erased. The
429 only reason to turn it off is if you frequently change your sources
430 list. Configuration Item: APT::Get::List-Cleanup.
431
432 -t, --target-release, --default-release
433 This option controls the default input to the policy engine; it
434 creates a default pin at priority 990 using the specified release
435 string. This overrides the general settings in
436 /etc/apt/preferences. Specifically pinned packages are not affected
437 by the value of this option. In short, this option lets you have
438 simple control over which distribution packages will be retrieved
439 from. Some common examples might be -t '2.1*', -t unstable or -t
440 sid. Configuration Item: APT::Default-Release; see also the
441 apt_preferences(5) manual page.
442
443 --trivial-only
444 Only perform operations that are 'trivial'. Logically this can be
445 considered related to --assume-yes; where --assume-yes will answer
446 yes to any prompt, --trivial-only will answer no. Configuration
447 Item: APT::Get::Trivial-Only.
448
449 --mark-auto
450 After successful installation, mark all freshly installed packages
451 as automatically installed, which will cause each of the packages
452 to be removed when no more manually installed packages depend on
453 this package. This is equally to running apt-mark auto for all
454 installed packages. Configuration Item: APT::Get::Mark-Auto.
455
456 --no-remove
457 If any packages are to be removed apt-get immediately aborts
458 without prompting. Configuration Item: APT::Get::Remove.
459
460 --auto-remove, --autoremove
461 If the command is either install or remove, then this option acts
462 like running the autoremove command, removing unused dependency
463 packages. Configuration Item: APT::Get::AutomaticRemove.
464
465 --only-source
466 Only has meaning for the source and build-dep commands. Indicates
467 that the given source names are not to be mapped through the binary
468 table. This means that if this option is specified, these commands
469 will only accept source package names as arguments, rather than
470 accepting binary package names and looking up the corresponding
471 source package. Configuration Item: APT::Get::Only-Source.
472
473 --diff-only, --dsc-only, --tar-only
474 Download only the diff, dsc, or tar file of a source archive.
475 Configuration Item: APT::Get::Diff-Only, APT::Get::Dsc-Only, and
476 APT::Get::Tar-Only.
477
478 --arch-only
479 Only process architecture-dependent build-dependencies.
480 Configuration Item: APT::Get::Arch-Only.
481
482 --indep-only
483 Only process architecture-independent build-dependencies.
484 Configuration Item: APT::Get::Indep-Only.
485
486 --allow-unauthenticated
487 Ignore if packages can't be authenticated and don't prompt about
488 it. This can be useful while working with local repositories, but
489 is a huge security risk if data authenticity isn't ensured in
490 another way by the user itself. The usage of the Trusted option for
491 sources.list(5) entries should usually be preferred over this
492 global override. Configuration Item:
493 APT::Get::AllowUnauthenticated.
494
495 --no-allow-insecure-repositories
496 Forbid the update command to acquire unverifiable data from
497 configured sources. APT will fail at the update command for
498 repositories without valid cryptographically signatures. See also
499 apt-secure(8) for details on the concept and the implications.
500 Configuration Item: Acquire::AllowInsecureRepositories.
501
502 --allow-releaseinfo-change
503 Allow the update command to continue downloading data from a
504 repository which changed its information of the release contained
505 in the repository indicating e.g a new major release. APT will fail
506 at the update command for such repositories until the change is
507 confirmed to ensure the user is prepared for the change. See also
508 apt-secure(8) for details on the concept and configuration.
509
510 Specialist options (--allow-releaseinfo-change-field) exist to
511 allow changes only for certain fields like origin, label, codename,
512 suite, version and defaultpin. See also apt_preferences(5).
513 Configuration Item: Acquire::AllowReleaseInfoChange.
514
515 --show-progress
516 Show user friendly progress information in the terminal window when
517 packages are installed, upgraded or removed. For a machine parsable
518 version of this data see README.progress-reporting in the apt doc
519 directory. Configuration Items: Dpkg::Progress and
520 Dpkg::Progress-Fancy.
521
522 --with-source filename
523 Adds the given file as a source for metadata. Can be repeated to
524 add multiple files. See --with-source description in apt-cache(8)
525 for further details.
526
527 -eany, --error-on=any
528 Fail the update command if any error occured, even a transient one.
529
530 -h, --help
531 Show a short usage summary.
532
533 -v, --version
534 Show the program version.
535
536 -c, --config-file
537 Configuration File; Specify a configuration file to use. The
538 program will read the default configuration file and then this
539 configuration file. If configuration settings need to be set before
540 the default configuration files are parsed specify a file with the
541 APT_CONFIG environment variable. See apt.conf(5) for syntax
542 information.
543
544 -o, --option
545 Set a Configuration Option; This will set an arbitrary
546 configuration option. The syntax is -o Foo::Bar=bar. -o and
547 --option can be used multiple times to set different options.
548
550 /etc/apt/sources.list
551 Locations to fetch packages from. Configuration Item:
552 Dir::Etc::SourceList.
553
554 /etc/apt/sources.list.d/
555 File fragments for locations to fetch packages from. Configuration
556 Item: Dir::Etc::SourceParts.
557
558 /etc/apt/apt.conf
559 APT configuration file. Configuration Item: Dir::Etc::Main.
560
561 /etc/apt/apt.conf.d/
562 APT configuration file fragments. Configuration Item:
563 Dir::Etc::Parts.
564
565 /etc/apt/preferences
566 Version preferences file. This is where you would specify
567 "pinning", i.e. a preference to get certain packages from a
568 separate source or from a different version of a distribution.
569 Configuration Item: Dir::Etc::Preferences.
570
571 /etc/apt/preferences.d/
572 File fragments for the version preferences. Configuration Item:
573 Dir::Etc::PreferencesParts.
574
575 /var/cache/apt/archives/
576 Storage area for retrieved package files. Configuration Item:
577 Dir::Cache::Archives.
578
579 /var/cache/apt/archives/partial/
580 Storage area for package files in transit. Configuration Item:
581 Dir::Cache::Archives (partial will be implicitly appended)
582
583 /var/lib/apt/lists/
584 Storage area for state information for each package resource
585 specified in sources.list(5) Configuration Item: Dir::State::Lists.
586
587 /var/lib/apt/lists/partial/
588 Storage area for state information in transit. Configuration Item:
589 Dir::State::Lists (partial will be implicitly appended)
590
592 apt-cache(8), apt-cdrom(8), dpkg(1), sources.list(5), apt.conf(5), apt-
593 config(8), apt-secure(8), The APT User's guide in
594 /usr/share/doc/apt-doc/, apt_preferences(5), the APT Howto.
595
597 apt-get returns zero on normal operation, decimal 100 on error.
598
600 APT bug page[1]. If you wish to report a bug in APT, please see
601 /usr/share/doc/debian/bug-reporting.txt or the reportbug(1) command.
602
604 Jason Gunthorpe
605
606 APT team
607
609 1. APT bug page
610 http://bugs.debian.org/src:apt
611
612
613
614APT 2.4.5 08 January 2021 APT-GET(8)