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.5.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. The authenticity of the package data is ensured as
199 usual.
200
201 clean
202 clean clears out the local repository of retrieved package files.
203 It removes everything but the lock file from
204 /var/cache/apt/archives/ and /var/cache/apt/archives/partial/.
205
206 autoclean (and the auto-clean alias since 1.1)
207 Like clean, autoclean clears out the local repository of retrieved
208 package files. The difference is that it only removes package files
209 that can no longer be downloaded, and are largely useless. This
210 allows a cache to be maintained over a long period without it
211 growing out of control. The configuration option
212 APT::Clean-Installed will prevent installed packages from being
213 erased if it is set to off.
214
215 autoremove (and the auto-remove alias since 1.1)
216 autoremove is used to remove packages that were automatically
217 installed to satisfy dependencies for other packages and are now no
218 longer needed.
219
220 autopurge
221 Like autoremove, but autopurge also removes configuration files.
222 This is a shortcut for autoremove --purge.
223
224 changelog
225 changelog tries to download the changelog of a package and displays
226 it through sensible-pager. By default it displays the changelog for
227 the version that is installed. However, you can specify the same
228 options as for the install command.
229
230 indextargets
231 Displays by default a deb822 formatted listing of information about
232 all data files (aka index targets) apt-get update would download.
233 Supports a --format option to modify the output format as well as
234 accepts lines of the default output to filter the records by. The
235 command is mainly used as an interface for external tools working
236 with APT to get information as well as filenames for downloaded
237 files so they can use them as well instead of downloading them
238 again on their own. Detailed documentation is omitted here and can
239 instead be found in the file
240 /usr/share/doc/apt/acquire-additional-files.md.gz shipped by the
241 apt-doc package.
242
244 All command line options may be set using the configuration file, the
245 descriptions indicate the configuration option to set. For boolean
246 options you can override the config file by using something like
247 -f-,--no-f, -f=no or several other variations.
248
249 --no-install-recommends
250 Do not consider recommended packages as a dependency for
251 installing. Configuration Item: APT::Install-Recommends.
252
253 --install-suggests
254 Consider suggested packages as a dependency for installing.
255 Configuration Item: APT::Install-Suggests.
256
257 -d, --download-only
258 Download only; package files are only retrieved, not unpacked or
259 installed. Configuration Item: APT::Get::Download-Only.
260
261 -f, --fix-broken
262 Fix; attempt to correct a system with broken dependencies in place.
263 This option, when used with install/remove, can omit any packages
264 to permit APT to deduce a likely solution. If packages are
265 specified, these have to completely correct the problem. The option
266 is sometimes necessary when running APT for the first time; APT
267 itself does not allow broken package dependencies to exist on a
268 system. It is possible that a system's dependency structure can be
269 so corrupt as to require manual intervention (which usually means
270 using dpkg --remove to eliminate some of the offending packages).
271 Use of this option together with -m may produce an error in some
272 situations. Configuration Item: APT::Get::Fix-Broken.
273
274 -m, --ignore-missing, --fix-missing
275 Ignore missing packages; if packages cannot be retrieved or fail
276 the integrity check after retrieval (corrupted package files), hold
277 back those packages and handle the result. Use of this option
278 together with -f may produce an error in some situations. If a
279 package is selected for installation (particularly if it is
280 mentioned on the command line) and it could not be downloaded then
281 it will be silently held back. Configuration Item:
282 APT::Get::Fix-Missing.
283
284 --no-download
285 Disables downloading of packages. This is best used with
286 --ignore-missing to force APT to use only the .debs it has already
287 downloaded. Configuration Item: APT::Get::Download.
288
289 -q, --quiet
290 Quiet; produces output suitable for logging, omitting progress
291 indicators. More q's will produce more quiet up to a maximum of 2.
292 You can also use -q=# to set the quiet level, overriding the
293 configuration file. Note that quiet level 2 implies -y; you should
294 never use -qq without a no-action modifier such as -d, --print-uris
295 or -s as APT may decide to do something you did not expect.
296 Configuration Item: quiet.
297
298 -s, --simulate, --just-print, --dry-run, --recon, --no-act
299 No action; perform a simulation of events that would occur based on
300 the current system state but do not actually change the system.
301 Locking will be disabled (Debug::NoLocking) so the system state
302 could change while apt-get is running. Simulations can also be
303 executed by non-root users which might not have read access to all
304 apt configuration distorting the simulation. A notice expressing
305 this warning is also shown by default for non-root users
306 (APT::Get::Show-User-Simulation-Note). Configuration Item:
307 APT::Get::Simulate.
308
309 Simulated runs print out a series of lines, each representing a
310 dpkg operation: configure (Conf), remove (Remv) or unpack (Inst).
311 Square brackets indicate broken packages, and empty square brackets
312 indicate breaks that are of no consequence (rare).
313
314 -y, --yes, --assume-yes
315 Automatic yes to prompts; assume "yes" as answer to all prompts and
316 run non-interactively. If an undesirable situation, such as
317 changing a held package, trying to install an unauthenticated
318 package or removing an essential package occurs then apt-get will
319 abort. Configuration Item: APT::Get::Assume-Yes.
320
321 --assume-no
322 Automatic "no" to all prompts. Configuration Item:
323 APT::Get::Assume-No.
324
325 --no-show-upgraded
326 Do not show a list of all packages that are to be upgraded.
327 Configuration Item: APT::Get::Show-Upgraded.
328
329 -V, --verbose-versions
330 Show full versions for upgraded and installed packages.
331 Configuration Item: APT::Get::Show-Versions.
332
333 -a, --host-architecture
334 This option controls the architecture packages are built for by
335 apt-get source --compile and how cross-builddependencies are
336 satisfied. By default is it not set which means that the host
337 architecture is the same as the build architecture (which is
338 defined by APT::Architecture). Configuration Item:
339 APT::Get::Host-Architecture.
340
341 -P, --build-profiles
342 This option controls the activated build profiles for which a
343 source package is built by apt-get source --compile and how build
344 dependencies are satisfied. By default no build profile is active.
345 More than one build profile can be activated at a time by
346 concatenating them with a comma. Configuration Item:
347 APT::Build-Profiles.
348
349 -b, --compile, --build
350 Compile source packages after downloading them. Configuration Item:
351 APT::Get::Compile.
352
353 --ignore-hold
354 Ignore package holds; this causes apt-get to ignore a hold placed
355 on a package. This may be useful in conjunction with dist-upgrade
356 to override a large number of undesired holds. Configuration Item:
357 APT::Ignore-Hold.
358
359 --with-new-pkgs
360 Allow installing new packages when used in conjunction with
361 upgrade. This is useful if the update of an installed package
362 requires new dependencies to be installed. Instead of holding the
363 package back upgrade will upgrade the package and install the new
364 dependencies. Note that upgrade with this option will never remove
365 packages, only allow adding new ones. Configuration Item:
366 APT::Get::Upgrade-Allow-New.
367
368 --no-upgrade
369 Do not upgrade packages; when used in conjunction with install,
370 no-upgrade will prevent packages on the command line from being
371 upgraded if they are already installed. Configuration Item:
372 APT::Get::Upgrade.
373
374 --only-upgrade
375 Do not install new packages; when used in conjunction with install,
376 only-upgrade will install upgrades for already installed packages
377 only and ignore requests to install new packages. Configuration
378 Item: APT::Get::Only-Upgrade.
379
380 --allow-downgrades
381 This is a dangerous option that will cause apt to continue without
382 prompting if it is doing downgrades. It should not be used except
383 in very special situations. Using it can potentially destroy your
384 system! Configuration Item: APT::Get::allow-downgrades. Introduced
385 in APT 1.1.
386
387 --allow-remove-essential
388 Force yes; this is a dangerous option that will cause apt to
389 continue without prompting if it is removing essentials. It should
390 not be used except in very special situations. Using it can
391 potentially destroy your system! Configuration Item:
392 APT::Get::allow-remove-essential. Introduced in APT 1.1.
393
394 --allow-change-held-packages
395 Force yes; this is a dangerous option that will cause apt to
396 continue without prompting if it is changing held packages. It
397 should not be used except in very special situations. Using it can
398 potentially destroy your system! Configuration Item:
399 APT::Get::allow-change-held-packages. Introduced in APT 1.1.
400
401 --force-yes
402 Force yes; this is a dangerous option that will cause apt to
403 continue without prompting if it is doing something potentially
404 harmful. It should not be used except in very special situations.
405 Using force-yes can potentially destroy your system! Configuration
406 Item: APT::Get::force-yes. This is deprecated and replaced by
407 --allow-unauthenticated , --allow-downgrades ,
408 --allow-remove-essential , --allow-change-held-packages in 1.1.
409
410 --print-uris
411 Instead of fetching the files to install their URIs are printed.
412 Each URI will have the path, the destination file name, the size
413 and the expected MD5 hash. Note that the file name to write to will
414 not always match the file name on the remote site! This also works
415 with the source and update commands. When used with the update
416 command the MD5 and size are not included, and it is up to the user
417 to decompress any compressed files. Configuration Item:
418 APT::Get::Print-URIs.
419
420 --purge
421 Use purge instead of remove for anything that would be removed. An
422 asterisk ("*") will be displayed next to packages which are
423 scheduled to be purged. remove --purge is equivalent to the purge
424 command. Configuration Item: APT::Get::Purge.
425
426 --reinstall
427 Re-install packages that are already installed and at the newest
428 version. Configuration Item: APT::Get::ReInstall.
429
430 --list-cleanup
431 This option is on by default; use --no-list-cleanup to turn it off.
432 When it is on, apt-get will automatically manage the contents of
433 /var/lib/apt/lists to ensure that obsolete files are erased. The
434 only reason to turn it off is if you frequently change your sources
435 list. Configuration Item: APT::Get::List-Cleanup.
436
437 -t, --target-release, --default-release
438 This option controls the default input to the policy engine; it
439 creates a default pin at priority 990 using the specified release
440 string. This overrides the general settings in
441 /etc/apt/preferences. Specifically pinned packages are not affected
442 by the value of this option. In short, this option lets you have
443 simple control over which distribution packages will be retrieved
444 from. Some common examples might be -t '2.1*', -t unstable or -t
445 sid. Configuration Item: APT::Default-Release; see also the
446 apt_preferences(5) manual page.
447
448 --trivial-only
449 Only perform operations that are 'trivial'. Logically this can be
450 considered related to --assume-yes; where --assume-yes will answer
451 yes to any prompt, --trivial-only will answer no. Configuration
452 Item: APT::Get::Trivial-Only.
453
454 --mark-auto
455 After successful installation, mark all freshly installed packages
456 as automatically installed, which will cause each of the packages
457 to be removed when no more manually installed packages depend on
458 this package. This is equally to running apt-mark auto for all
459 installed packages. Configuration Item: APT::Get::Mark-Auto.
460
461 --no-remove
462 If any packages are to be removed apt-get immediately aborts
463 without prompting. Configuration Item: APT::Get::Remove.
464
465 --auto-remove, --autoremove
466 If the command is either install or remove, then this option acts
467 like running the autoremove command, removing unused dependency
468 packages. Configuration Item: APT::Get::AutomaticRemove.
469
470 --only-source
471 Only has meaning for the source and build-dep commands. Indicates
472 that the given source names are not to be mapped through the binary
473 table. This means that if this option is specified, these commands
474 will only accept source package names as arguments, rather than
475 accepting binary package names and looking up the corresponding
476 source package. Configuration Item: APT::Get::Only-Source.
477
478 --diff-only, --dsc-only, --tar-only
479 Download only the diff, dsc, or tar file of a source archive.
480 Configuration Item: APT::Get::Diff-Only, APT::Get::Dsc-Only, and
481 APT::Get::Tar-Only.
482
483 --arch-only
484 Only process architecture-dependent build-dependencies.
485 Configuration Item: APT::Get::Arch-Only.
486
487 --indep-only
488 Only process architecture-independent build-dependencies.
489 Configuration Item: APT::Get::Indep-Only.
490
491 --allow-unauthenticated
492 Ignore if packages can't be authenticated and don't prompt about
493 it. This can be useful while working with local repositories, but
494 is a huge security risk if data authenticity isn't ensured in
495 another way by the user itself. The usage of the Trusted option for
496 sources.list(5) entries should usually be preferred over this
497 global override. Configuration Item:
498 APT::Get::AllowUnauthenticated.
499
500 --no-allow-insecure-repositories
501 Forbid the update command to acquire unverifiable data from
502 configured sources. APT will fail at the update command for
503 repositories without valid cryptographically signatures. See also
504 apt-secure(8) for details on the concept and the implications.
505 Configuration Item: Acquire::AllowInsecureRepositories.
506
507 --allow-releaseinfo-change
508 Allow the update command to continue downloading data from a
509 repository which changed its information of the release contained
510 in the repository indicating e.g a new major release. APT will fail
511 at the update command for such repositories until the change is
512 confirmed to ensure the user is prepared for the change. See also
513 apt-secure(8) for details on the concept and configuration.
514
515 Specialist options (--allow-releaseinfo-change-field) exist to
516 allow changes only for certain fields like origin, label, codename,
517 suite, version and defaultpin. See also apt_preferences(5).
518 Configuration Item: Acquire::AllowReleaseInfoChange.
519
520 --show-progress
521 Show user friendly progress information in the terminal window when
522 packages are installed, upgraded or removed. For a machine parsable
523 version of this data see README.progress-reporting in the apt doc
524 directory. Configuration Items: Dpkg::Progress and
525 Dpkg::Progress-Fancy.
526
527 --with-source filename
528 Adds the given file as a source for metadata. Can be repeated to
529 add multiple files. See --with-source description in apt-cache(8)
530 for further details.
531
532 -eany, --error-on=any
533 Fail the update command if any error occured, even a transient one.
534
535 -h, --help
536 Show a short usage summary.
537
538 -v, --version
539 Show the program version.
540
541 -c, --config-file
542 Configuration File; Specify a configuration file to use. The
543 program will read the default configuration file and then this
544 configuration file. If configuration settings need to be set before
545 the default configuration files are parsed specify a file with the
546 APT_CONFIG environment variable. See apt.conf(5) for syntax
547 information.
548
549 -o, --option
550 Set a Configuration Option; This will set an arbitrary
551 configuration option. The syntax is -o Foo::Bar=bar. -o and
552 --option can be used multiple times to set different options.
553
555 /etc/apt/sources.list
556 Locations to fetch packages from. Configuration Item:
557 Dir::Etc::SourceList.
558
559 /etc/apt/sources.list.d/
560 File fragments for locations to fetch packages from. Configuration
561 Item: Dir::Etc::SourceParts.
562
563 /etc/apt/apt.conf
564 APT configuration file. Configuration Item: Dir::Etc::Main.
565
566 /etc/apt/apt.conf.d/
567 APT configuration file fragments. Configuration Item:
568 Dir::Etc::Parts.
569
570 /etc/apt/preferences
571 Version preferences file. This is where you would specify
572 "pinning", i.e. a preference to get certain packages from a
573 separate source or from a different version of a distribution.
574 Configuration Item: Dir::Etc::Preferences.
575
576 /etc/apt/preferences.d/
577 File fragments for the version preferences. Configuration Item:
578 Dir::Etc::PreferencesParts.
579
580 /var/cache/apt/archives/
581 Storage area for retrieved package files. Configuration Item:
582 Dir::Cache::Archives.
583
584 /var/cache/apt/archives/partial/
585 Storage area for package files in transit. Configuration Item:
586 Dir::Cache::Archives (partial will be implicitly appended)
587
588 /var/lib/apt/lists/
589 Storage area for state information for each package resource
590 specified in sources.list(5) Configuration Item: Dir::State::Lists.
591
592 /var/lib/apt/lists/partial/
593 Storage area for state information in transit. Configuration Item:
594 Dir::State::Lists (partial will be implicitly appended)
595
597 apt-cache(8), apt-cdrom(8), dpkg(1), sources.list(5), apt.conf(5), apt-
598 config(8), apt-secure(8), The APT User's guide in
599 /usr/share/doc/apt-doc/, apt_preferences(5), the APT Howto.
600
602 apt-get returns zero on normal operation, decimal 100 on error.
603
605 APT bug page[1]. If you wish to report a bug in APT, please see
606 /usr/share/doc/debian/bug-reporting.txt or the reportbug(1) command.
607
609 Jason Gunthorpe
610
611 APT team
612
614 1. APT bug page
615 http://bugs.debian.org/src:apt
616
617
618
619APT 2.5.5 28 October 2022 APT-GET(8)