apt-mark — show, set and unset various settings for a package
| Use Case | Command | Description |
|---|---|---|
| Mark package as automatically installed | apt-mark auto <package> | Package will be removed when no longer needed |
| Mark package as manually installed | apt-mark manual <package> | Prevent automatic removal |
| Show automatically installed packages | apt-mark showauto | List all auto‑installed packages |
| Show manually installed packages | apt-mark showmanual | List all manually installed packages |
| Hold a package (prevent changes) | apt-mark hold <package> | Block upgrades, installs, or removal |
| Unhold a package | apt-mark unhold <package> | Allow changes again |
| Schedule install | apt-mark install <package> | Mark for installation |
| Schedule remove (deinstall) | apt-mark remove <package> | Mark for removal |
| Schedule purge | apt-mark purge <package> | Mark for purge (remove config too) |
| Show held packages | apt-mark showhold | List packages on hold |
| Show scheduled installs | apt-mark showinstall | List packages marked for install |
| Show scheduled removals | apt-mark showremove | List packages marked for removal |
| Show scheduled purges | apt-mark showpurge | List packages marked for purge |
apt-mark {-f=filename | {auto | manual} pkg... |
{showauto | showmanual} [pkg...] } | {-v | --version} |
{-h | --help}
apt-mark {hold | unhold | install | remove | purge} pkg... |
{showhold | showinstall | showremove | showpurge} [pkg...]
apt-mark can be used as a unified front‑end to set various settings for a package, such as marking a package as being automatically/manually installed or changing dpkg selections such as hold, install, deinstall and purge which are respected e.g. by apt-get(8) dselect‑upgrade or aptitude(8).
When you request that a package is installed, and as a result other packages are installed to satisfy its dependencies, the dependencies are marked as being automatically installed, while the package you installed explicitly is marked as manually installed. Once an automatically installed package is no longer depended on by any manually installed package it is considered no longer needed and e.g. apt‑get or aptitude will at least suggest removing them.
auto is used to mark a package as being automatically installed, which will cause the package to be removed when no more manually installed packages depend on this package.
manual is used to mark a package as being manually installed, which will prevent the package from being automatically removed if no other packages depend on it.
minimize‑manual is used to mark (transitive) dependencies of metapackages as automatically installed. This can be used after an installation for example, to minimize the number of manually installed packages; or continuously on systems managed by system configuration metapackages.
showauto is used to print a list of automatically installed packages with each package on a new line. All automatically installed packages will be listed if no package is given. If packages are given only those which are automatically installed will be shown.
showmanual can be used in the same way as showauto except that it will print a list of manually installed packages instead.
-f=filename, --file=filename — Read/Write package stats from the filename given with the parameter filename instead of from the default location, which is extended_states in the directory defined by the Configuration Item: Dir::State.hold is used to mark a package as held back, which will prevent the package from being automatically installed, upgraded or removed.
unhold is used to cancel a previously set hold on a package to allow all actions again.
showhold is used to print a list of packages on hold in the same way as for the other show commands.
Some front‑ends like apt‑get dselect‑upgrade can be used to apply previously scheduled changes to the install state of packages. Such changes can be scheduled with the install, remove (also known as deinstall) and purge commands. Packages with a specific selection can be displayed with showinstall, showremove and showpurge respectively. More information about these so called dpkg selections can be found in dpkg(1).
Show a short usage summary.
Show the program version.
Configuration File; Specify a configuration file to use. The program will read the default configuration file and then this configuration file. If configuration settings need to be set before the default configuration files are parsed specify a file with the APT_CONFIG environment variable. See apt.conf(5) for syntax information.
Set a Configuration Option; This will set an arbitrary configuration option. The syntax is -o Foo::Bar=bar. -o and --option can be used multiple times to set different options.
/var/lib/apt/extended_states — Status list of auto‑installed packages. Configuration Item: Dir::State::extended_states.apt‑mark returns zero on normal operation, non‑zero on error.
apt-get(8), aptitude(8), apt.conf(5)
APT bug page[1]. If you wish to report a bug in APT, please see /usr/share/doc/debian/bug-reporting.txt or the reportbug(1) command.
Mike O'Connor
APT team
Generated by phpman v4.9.26-5-g7740029 Author: Che Dong Under GNU General Public License
2026-08-16 08:52 @2600:1f28:365:80b0:7cb9:fb:26c1:e368
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)