{
    "content": [
        {
            "type": "text",
            "text": "# dirname (man)\n\n## NAME\n\ndirname - strip last component from file name\n\n## SYNOPSIS\n\ndirname [OPTION] NAME...\n\n## DESCRIPTION\n\nOutput each NAME with its last non-slash component and trailing slashes removed; if NAME con‐\ntains no /'s, output '.' (meaning the current directory).\n\n## TLDR\n\n> Remove trailing filename portion from a path.\n\n- Calculate the parent directory of a given path:\n  `dirname {{path/to/file_or_directory}}`\n- Calculate the parent directory of multiple paths:\n  `dirname {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`\n- Delimit output with a NUL character instead of a newline (useful when combining with `xargs`):\n  `dirname {{-z|--zero}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (2 subsections)\n- **EXAMPLES**\n- **AUTHOR**\n- **REPORTING BUGS**\n- **COPYRIGHT**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "dirname",
        "section": "",
        "mode": "man",
        "summary": "dirname - strip last component from file name",
        "synopsis": "dirname [OPTION] NAME...",
        "tldr_summary": "Remove trailing filename portion from a path.",
        "tldr_examples": [
            {
                "description": "Calculate the parent directory of a given path",
                "command": "dirname {{path/to/file_or_directory}}"
            },
            {
                "description": "Calculate the parent directory of multiple paths",
                "command": "dirname {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}"
            },
            {
                "description": "Delimit output with a NUL character instead of a newline (useful when combining with `xargs`)",
                "command": "dirname {{-z|--zero}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "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": [
            "dirname /usr/bin/",
            "-> \"/usr\"",
            "dirname dir1/str dir2/str",
            "-> \"dir1\" followed by \"dir2\"",
            "dirname stdio.h",
            "-> \".\""
        ],
        "see_also": [
            {
                "name": "basename",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/basename/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": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": [
                    {
                        "name": "-z --zero",
                        "lines": 4,
                        "flag": "-z",
                        "long": "--zero"
                    },
                    {
                        "name": "--version",
                        "lines": 2,
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "EXAMPLES",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "REPORTING BUGS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 8,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "dirname - strip last component from file name\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "dirname [OPTION] NAME...\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Output each NAME with its last non-slash component and trailing slashes removed; if NAME con‐\ntains no /'s, output '.' (meaning the current directory).\n",
                "subsections": [
                    {
                        "name": "-z --zero",
                        "content": "end each output line with NUL, not newline\n\n--help display this help and exit\n",
                        "flag": "-z",
                        "long": "--zero"
                    },
                    {
                        "name": "--version",
                        "content": "output version information and exit\n",
                        "long": "--version"
                    }
                ]
            },
            "EXAMPLES": {
                "content": "dirname /usr/bin/\n-> \"/usr\"\n\ndirname dir1/str dir2/str\n-> \"dir1\" followed by \"dir2\"\n\ndirname stdio.h\n-> \".\"\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Written by David MacKenzie and Jim Meyering.\n",
                "subsections": []
            },
            "REPORTING BUGS": {
                "content": "GNU coreutils online help: <https://www.gnu.org/software/coreutils/>\nReport any translation bugs to <https://translationproject.org/team/>\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright © 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",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "basename(1), readlink(1)\n\nFull documentation <https://www.gnu.org/software/coreutils/dirname>\nor available locally via: info '(coreutils) dirname invocation'\n\n\n\nGNU coreutils 8.32                          January 2026                                  DIRNAME(1)",
                "subsections": []
            }
        }
    }
}