{
    "content": [
        {
            "type": "text",
            "text": "# BASENAME(1) (man)\n\n**Summary:** basename - strip directory and suffix from filenames\n\n**Synopsis:** basename NAME [SUFFIX]\nbasename OPTION... NAME...\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| -a | --multiple | — | support multiple arguments and treat each as a NAME |\n| -s | --suffix | — | remove a trailing SUFFIX; implies -a |\n| -z | --zero | — | end each output line with NUL, not newline --help display this help and exit |\n| — | --version | — | output version information and exit |\n\n## Examples\n\n- `basename /usr/bin/sort`\n- `-> \"sort\"`\n- `basename include/stdio.h .h`\n- `-> \"stdio\"`\n- `basename -s .h include/stdio.h`\n- `-> \"stdio\"`\n- `basename -a any/str1 any/str2`\n- `-> \"str1\" followed by \"str2\"`\n\n## See Also\n\n- dirname(1)\n- readlink(1)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (3 lines)\n- **DESCRIPTION** (5 lines) — 4 subsections\n  - -a --multiple (2 lines)\n  - -s --suffix (2 lines)\n  - -z --zero (4 lines)\n  - --version (2 lines)\n- **EXAMPLES** (12 lines)\n- **AUTHOR** (2 lines)\n- **REPORTING BUGS** (3 lines)\n- **COPYRIGHT** (5 lines)\n- **SEE ALSO** (8 lines)\n\n## Full Content\n\n### NAME\n\nbasename - strip directory and suffix from filenames\n\n### SYNOPSIS\n\nbasename NAME [SUFFIX]\nbasename OPTION... NAME...\n\n### DESCRIPTION\n\nPrint NAME with any leading directory components removed.  If specified, also remove a trail‐\ning SUFFIX.\n\nMandatory arguments to long options are mandatory for short options too.\n\n#### -a --multiple\n\nsupport multiple arguments and treat each as a NAME\n\n#### -s --suffix\n\nremove a trailing SUFFIX; implies -a\n\n#### -z --zero\n\nend each output line with NUL, not newline\n\n--help display this help and exit\n\n#### --version\n\noutput version information and exit\n\n### EXAMPLES\n\nbasename /usr/bin/sort\n-> \"sort\"\n\nbasename include/stdio.h .h\n-> \"stdio\"\n\nbasename -s .h include/stdio.h\n-> \"stdio\"\n\nbasename -a any/str1 any/str2\n-> \"str1\" followed by \"str2\"\n\n### AUTHOR\n\nWritten by David MacKenzie.\n\n### REPORTING BUGS\n\nGNU coreutils online help: <https://www.gnu.org/software/coreutils/>\nReport any translation bugs to <https://translationproject.org/team/>\n\n### COPYRIGHT\n\nCopyright © 2020 Free Software Foundation, Inc.  License GPLv3+: GNU GPL version 3  or  later\n<https://gnu.org/licenses/gpl.html>.\nThis  is free software: you are free to change and redistribute it.  There is NO WARRANTY, to\nthe extent permitted by law.\n\n### SEE ALSO\n\ndirname(1), readlink(1)\n\nFull documentation <https://www.gnu.org/software/coreutils/basename>\nor available locally via: info '(coreutils) basename invocation'\n\n\n\nGNU coreutils 8.32                          January 2026                                 BASENAME(1)\n\n"
        }
    ],
    "structuredContent": {
        "command": "BASENAME",
        "section": "1",
        "mode": "man",
        "summary": "basename - strip directory and suffix from filenames",
        "synopsis": "basename NAME [SUFFIX]\nbasename OPTION... NAME...",
        "flags": [
            {
                "flag": "-a",
                "long": "--multiple",
                "arg": null,
                "description": "support multiple arguments and treat each as a NAME"
            },
            {
                "flag": "-s",
                "long": "--suffix",
                "arg": null,
                "description": "remove a trailing SUFFIX; implies -a"
            },
            {
                "flag": "-z",
                "long": "--zero",
                "arg": null,
                "description": "end each output line with NUL, not newline --help display this help and exit"
            },
            {
                "flag": "",
                "long": "--version",
                "arg": null,
                "description": "output version information and exit"
            }
        ],
        "examples": [
            "basename /usr/bin/sort",
            "-> \"sort\"",
            "basename include/stdio.h .h",
            "-> \"stdio\"",
            "basename -s .h include/stdio.h",
            "-> \"stdio\"",
            "basename -a any/str1 any/str2",
            "-> \"str1\" followed by \"str2\""
        ],
        "see_also": [
            {
                "name": "dirname",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/dirname/1/json"
            },
            {
                "name": "readlink",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/readlink/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 5,
                "subsections": [
                    {
                        "name": "-a --multiple",
                        "lines": 2,
                        "flag": "-a",
                        "long": "--multiple"
                    },
                    {
                        "name": "-s --suffix",
                        "lines": 2,
                        "flag": "-s",
                        "long": "--suffix"
                    },
                    {
                        "name": "-z --zero",
                        "lines": 4,
                        "flag": "-z",
                        "long": "--zero"
                    },
                    {
                        "name": "--version",
                        "lines": 2,
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "EXAMPLES",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "REPORTING BUGS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 8,
                "subsections": []
            }
        ]
    }
}