{
    "content": [
        {
            "type": "text",
            "text": "# APT-PATTERNS (man)\n\n## NAME\n\napt-patterns - Syntax and semantics of apt search patterns\n\n## DESCRIPTION\n\nStarting with version 2.0, APT provides support for patterns, which can be used to query the\napt cache for packages.\n\n## Sections\n\n- **NAME**\n- **DESCRIPTION**\n- **LOGIC PATTERNS**\n- **NARROWING PATTERNS**\n- **PACKAGE PATTERNS**\n- **VERSION PATTERNS**\n- **PACKAGE RELATIONSHIP PATTERNS**\n- **EXAMPLES**\n- **MIGRATING FROM APTITUDE**\n- **SEE ALSO**\n- **BUGS**\n- **AUTHOR**\n- **AUTHORS** (2 subsections)\n- **NOTES**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "APT-PATTERNS",
        "section": "",
        "mode": "man",
        "summary": "apt-patterns - Syntax and semantics of apt search patterns",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "apt remove ?garbage",
            "Remove all packages that are automatically installed and no longer needed - same as apt",
            "autoremove",
            "apt purge ?config-files",
            "Purge all packages that only have configuration files left",
            "apt list '~i !~M (~slibs|~sperl|~spython)'",
            "List all manually-installed packages in sections matching libs, perl, or python."
        ],
        "see_also": [
            {
                "name": "apt-get",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/apt-get/8/json"
            },
            {
                "name": "apt",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/apt/8/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "LOGIC PATTERNS",
                "lines": 22,
                "subsections": []
            },
            {
                "name": "NARROWING PATTERNS",
                "lines": 14,
                "subsections": []
            },
            {
                "name": "PACKAGE PATTERNS",
                "lines": 42,
                "subsections": []
            },
            {
                "name": "VERSION PATTERNS",
                "lines": 30,
                "subsections": []
            },
            {
                "name": "PACKAGE RELATIONSHIP PATTERNS",
                "lines": 16,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "MIGRATING FROM APTITUDE",
                "lines": 28,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Jason Gunthorpe",
                        "lines": 1
                    },
                    {
                        "name": "APT team",
                        "lines": 1
                    }
                ]
            },
            {
                "name": "NOTES",
                "lines": 6,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "apt-patterns - Syntax and semantics of apt search patterns\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Starting with version 2.0, APT provides support for patterns, which can be used to query the\napt cache for packages.\n",
                "subsections": []
            },
            "LOGIC PATTERNS": {
                "content": "These patterns provide the basic means to combine other patterns into more complex\nexpressions, as well as ?true and ?false patterns.\n\n?and(PATTERN, PATTERN, ...), PATTERN PATTERN ...\nSelects objects where all specified patterns match.\n\n?false, ~F\nSelects nothing.\n\n?not(PATTERN), !PATTERN\nSelects objects where PATTERN does not match.\n\n?or(PATTERN, PATTERN, ...), PATTERN | PATTERN | ...\nSelects objects where at least one of the specified patterns match.\n\n?true, ~T\nSelects all objects.\n\n(PATTERN)\nSelects the same as PATTERN, can be used to work around precedence, for example,\n(~ramd64|~ri386)~nfoo\n",
                "subsections": []
            },
            "NARROWING PATTERNS": {
                "content": "?all-versions(PATTERN)\nSelects packages where all versions match PATTERN. When matching versions instead, same\nas PATTERN.\n\n?any-version(PATTERN)\nSelects any version where the pattern matches on the version.\n\nFor example, while ?and(?version(1),?version(2)) matches a package which has one version\ncontaining 1 and one version containing 2, ?any-version(?and(?version(1),?version(2)))\nrestricts the ?and to act on the same version.\n\n?narrow(PATTERN...)\nSelects any version matching all PATTERNs, short for ?any-version(?and(PATTERN...)).\n",
                "subsections": []
            },
            "PACKAGE PATTERNS": {
                "content": "These patterns select specific packages.\n\n?architecture(WILDCARD), ~rWILDCARD\nSelects packages matching the specified architecture, which may contain wildcards using\nany.\n\n?automatic, ~M\nSelects packages that were installed automatically.\n\n?broken, ~b\nSelects packages that have broken dependencies.\n\n?config-files, ~c\nSelects packages that are not fully installed, but have solely residual configuration\nfiles left.\n\n?essential, ~E\nSelects packages that have Essential: yes set in their control file.\n\n?exact-name(NAME)\nSelects packages with the exact specified name.\n\n?garbage, ~g\nSelects packages that can be removed automatically.\n\n?installed, ~i\nSelects packages that are currently installed.\n\n?name(REGEX), ~nREGEX\nSelects packages where the name matches the given regular expression.\n\n?obsolete, ~o\nSelects packages that no longer exist in repositories.\n\n?upgradable, ~U\nSelects packages that can be upgraded (have a newer candidate).\n\n?virtual, ~v\nSelects all virtual packages; that is packages without a version. These exist when they\nare referenced somewhere in the archive, for example because something depends on that\nname.\n",
                "subsections": []
            },
            "VERSION PATTERNS": {
                "content": "These patterns select specific versions of a package.\n\n?archive(REGEX), ~AREGEX\nSelects versions that come from the archive that matches the specified regular\nexpression. Archive, here, means the values after a= in apt-cache policy.\n\n?codename(REGEX)\nSelects versions that come from the codename that matches the specified regular\nexpression. Codename, here, means the values after n= in apt-cache policy.\n\n?origin(REGEX), ~OREGEX\nSelects versions that come from the origin that matches the specified regular expression.\nOrigin, here, means the values after o= in apt-cache policy.\n\n?section(REGEX), ~sREGEX\nSelects versions where the section matches the specified regular expression.\n\n?source-package(REGEX), ~eREGEX\nSelects versions where the source package name matches the specified regular expression.\n\n?source-version(REGEX)\nSelects versions where the source package version matches the specified regular\nexpression.\n\n?version(REGEX), ~VREGEX\nSelects versions where the version string matches the specified regular expression.\n\n?priority(NAME), ~pNAME\nSelects versions where the Priority string equals the given name.\n",
                "subsections": []
            },
            "PACKAGE RELATIONSHIP PATTERNS": {
                "content": "These patterns match specific package versions that depend/conflict with some other packages.\n\n?depends(PATTERN), ~DPATTERN, ?pre-depends(PATTERN), ~DPre-Depends:PATTERN,\n?suggests(PATTERN), ~DSuggests:PATTERN, ?conflicts(PATTERN), ~DConflicts:PATTERN,\n?replaces(PATTERN), ~DReplaces:PATTERN, ?obsoletes(PATTERN), ~DObsoletes:PATTERN,\n?breaks(PATTERN), ~DBreaks:PATTERN, ?enhances(PATTERN), ~DEnhances:PATTERN\nSelects versions depending/pre-depending/suggesting/conflicting/etc on/with/ packages\nmatching PATTERN.\n\n?reverse-depType(PATTERN), ~RDepType:PATTERN\nOpposite of ?depends and friends - selects all packages that have reverse-dependencies\n(versions) matching PATTERN.\n\ndepType is one of the dependency types such as depends, so that we don't have to repeat\nthe entire list from the first paragraph here.\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "apt remove ?garbage\nRemove all packages that are automatically installed and no longer needed - same as apt\nautoremove\n\napt purge ?config-files\nPurge all packages that only have configuration files left\n\napt list '~i !~M (~slibs|~sperl|~spython)'\nList all manually-installed packages in sections matching libs, perl, or python.\n",
                "subsections": []
            },
            "MIGRATING FROM APTITUDE": {
                "content": "Patterns in apt are heavily inspired by patterns in aptitude, but with some tweaks:\n\n•   Syntax is uniform: If there is an opening parenthesis after a term, it is always assumed\nto be the beginning of an argument list.\n\nIn aptitude, a syntactic form \"?foo(bar)\" could mean \"?and(?foo,bar)\" if foo does not\ntake an argument. In APT, this will cause an error.\n\n•   Not all patterns are supported.\n\n•   Some additional patterns are available, for example, for finding gstreamer codecs.\n\n•   Escaping terms with ~ is not supported.\n\n•   A trailing comma is allowed in argument lists\n\n•   ?narrow accepts infinite arguments\n\n•   foo cannot be used as a shortform for ?name(foo), as this can cause typos to go\nunnoticed: Consider ?and(...,~poptional): this requires the package to have required\npriority, but if you do not type the ~, it would require the package name to contain\npoptional.\n\n•   Grouping patterns with (...)  or writing ?or(A,B) as A|B are not supported. We do not\nbelieve that the use of | is that common, and the grouping is not necessary without it.\n\n•   Dependency types for ~D and related operators need to be specified in the canonical case.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "apt-get(8), apt(8)\n",
                "subsections": []
            },
            "BUGS": {
                "content": "APT bug page[1]. If you wish to report a bug in APT, please see\n/usr/share/doc/debian/bug-reporting.txt or the reportbug(1) command.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "APT was written by the APT team <apt@packages.debian.org>.\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "",
                "subsections": [
                    {
                        "name": "Jason Gunthorpe",
                        "content": ""
                    },
                    {
                        "name": "APT team",
                        "content": ""
                    }
                ]
            },
            "NOTES": {
                "content": "1. APT bug page\nhttp://bugs.debian.org/src:apt\n\n\n\nAPT 2.4.14                                26 December 2021                           APT-PATTERNS(7)",
                "subsections": []
            }
        }
    }
}